File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 185185 order-by =" id"
186186 :sort-desc =" false"
187187 :is-loading =" false"
188+ row-clickable
189+ @row-clicked =" onRowClicked"
188190 >
189191 <template #td =" data " >
190192 <span v-if =" data.field === 'action'" >
191- <button type =" button" class =" btn btn-primary" >Download</button >
193+ <button type =" button" class =" btn btn-primary" @click.stop = " onTableButtonClicked " >Download</button >
192194 </span >
193195 <template v-else >
194196 {{ data.value }}
@@ -358,6 +360,12 @@ export default defineComponent({
358360 // event.preventDefault()
359361 console .log (event )
360362 },
363+ onRowClicked(row : { id: number ; name: string }): void {
364+ console .log (' Row clicked' , row )
365+ },
366+ onTableButtonClicked() {
367+ console .log (' Only button clicked (because of @click.stop)' )
368+ },
361369 },
362370})
363371 </script >
Original file line number Diff line number Diff line change 11{
22 "name" : " bootstrap-vue-wrapper" ,
3- "version" : " 2.1.17 " ,
3+ "version" : " 2.1.18 " ,
44 "description" : " Bootstrap 5 components in Vue3 wrapper." ,
55 "module" : " ./dist/bootstrap-vue-wrapper.js" ,
66 "types" : " ./dist/index.d.ts" ,
Original file line number Diff line number Diff line change 4040 v-for =" (item, key) in items"
4141 v-else
4242 :key =" key"
43- :class =" item.trClass"
43+ :class =" [item.trClass || '', { 'cursor-pointer': rowClickable }]"
44+ @click =" $emit('rowClicked', item)"
4445 >
4546 <template v-for =" field in fields " :key =" field .key " >
4647 <td
@@ -118,8 +119,15 @@ export default defineComponent({
118119 type: String ,
119120 default: undefined ,
120121 },
122+ /**
123+ * row is clickable
124+ */
125+ rowClickable: {
126+ type: Boolean ,
127+ default: false ,
128+ },
121129 },
122- emits: [' orderChanged' ],
130+ emits: [' orderChanged' , ' rowClicked ' ],
123131 methods: {
124132 /**
125133 * Is order by active by field?
You can’t perform that action at this time.
0 commit comments