Let caller specify how to generate row item routes, for model-crud

This commit is contained in:
Lance Edgar 2019-11-15 10:30:51 -06:00
parent d8e215a1dd
commit 55efba432a

View file

@ -64,7 +64,7 @@
<b-menu-item v-for="row in rowData.data" <b-menu-item v-for="row in rowData.data"
:key="row.uuid" :key="row.uuid"
tag="router-link" tag="router-link"
:to="getRowPathPrefix() + '/' + row.uuid"> :to="getRowRoute(row)">
<template slot="label" slot-scope="props"> <template slot="label" slot-scope="props">
<span v-html="renderRowLabel(row)"></span> <span v-html="renderRowLabel(row)"></span>
</template> </template>
@ -116,6 +116,7 @@ export default {
type: Number, type: Number,
default: 20, default: 20,
}, },
rowRouteGetter: Function,
apiRowsUrl: String, apiRowsUrl: String,
isRow: { isRow: {
type: Boolean, type: Boolean,
@ -400,6 +401,13 @@ export default {
}) })
}, },
getRowRoute(row) {
if (this.rowRouteGetter) {
return this.rowRouteGetter(row)
}
return this.getRowPathPrefix() + '/' + row.uuid
},
changeRowPagination(value) { changeRowPagination(value) {
this.fetchRows(this.record.uuid) this.fetchRows(this.record.uuid)
}, },