为发射事件添加额外的参数 - Quasar
Add additional argument for emit events - Quasar
我正在使用 Quasar 框架。并想在框架组件的预设上添加第三个参数。
这是 Q-popup-edit
的 save
/ cancel
事件:
语法:
@save
-> function(value, initialValue)
描述
值已成功验证并应保存时发出
参数:
value
- 要保存的验证值
initialValue
- 更改前的初始值
有没有办法让我不必指定 'new' 和 'old' 值而只需传入我的第三个参数?
@save="saved(.., .., arg3)"
或类似 @cancel="canceled(arg3)"
。如果那不可能,那么我该如何传递初始值和新值?
<q-popup-edit buttons lazy-rule v-model="props.row.value" @save=(newValue, initialValue, arg3)?
...
methods: {
saved (val, initialValue, arg3) {
console.log(`original value = ${initialValue}, new value = ${val}`)
console.log('argument3 = ' + arg3)
},
canceled (val, initialValue, arg3) {
console.log(`retain original value = ${initialValue}, canceled value = ${val}`)
console.log('argument3 = ' + arg3)
}
}
...
Quasar Q-popup-edit 文档:
https://quasar.dev/vue-components/popup-edit
你可以做到这一点。
例子-
@filter="(val,update,abort) => yourFilterFn(val,update,abort,yourCustomParam)"
@save="(newValue, initialValue) => yourFilterFn(newValue,initialValue,third_argument)"
我正在使用 Quasar 框架。并想在框架组件的预设上添加第三个参数。
这是 Q-popup-edit
的 save
/ cancel
事件:
语法:
@save
-> function(value, initialValue)
描述
值已成功验证并应保存时发出
参数:
value
- 要保存的验证值
initialValue
- 更改前的初始值
有没有办法让我不必指定 'new' 和 'old' 值而只需传入我的第三个参数?
@save="saved(.., .., arg3)"
或类似 @cancel="canceled(arg3)"
。如果那不可能,那么我该如何传递初始值和新值?
<q-popup-edit buttons lazy-rule v-model="props.row.value" @save=(newValue, initialValue, arg3)?
...
methods: {
saved (val, initialValue, arg3) {
console.log(`original value = ${initialValue}, new value = ${val}`)
console.log('argument3 = ' + arg3)
},
canceled (val, initialValue, arg3) {
console.log(`retain original value = ${initialValue}, canceled value = ${val}`)
console.log('argument3 = ' + arg3)
}
}
...
Quasar Q-popup-edit 文档: https://quasar.dev/vue-components/popup-edit
你可以做到这一点。
例子-
@filter="(val,update,abort) => yourFilterFn(val,update,abort,yourCustomParam)"
@save="(newValue, initialValue) => yourFilterFn(newValue,initialValue,third_argument)"