我需要将此脚本从 js 更改为 ts 但我需要观察者的语法
export default {
props: ['branch_id'],
watch: {}
}
Run Code Online (Sandbox Code Playgroud)
Dji*_*jip 11
首先,您必须声明您的变量,就像myProperty在这种情况下一样,然后您必须创建 a@Watch('myProperty')来为该特定变量创建实际的观察者。
@Component
export default class App extends Vue {
myProperty: string
@Watch('myProperty')
onPropertyChanged(value: string, oldValue: string) {
// Do stuff with the watcher here.
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9037 次 |
| 最近记录: |