Observe model properties using Vue 3 and Typescript
P粉143640496
P粉143640496 2023-09-02 23:07:50
0
1
443
<p>I'm trying to monitor my Typescript model properties and it works but gives a warning in the console and I can't find how to remove it. </p> <p>This is my Typescript model: </p> <pre class="brush:php;toolbar:false;">import { watch, ref, Ref, reactive } from 'vue' export default class Resa { public id: Number = 0 public deferred_invoicing: Ref<Boolean> = ref(false) constructor(properties?: Object) { watch(this.deferred_invoicing, (newValue, oldValue) => { console.log(newValue) } } }</pre> <p>The watch is working fine, but I have this warning in the console<code>[Vue warn]: Invalid watch source: false A watch source can only be a getter/effect function, a ref, a reactive object , or an array of these types.</code></p> <p>Did I do something wrong? </p> <p>I have tried using the string <code>'deferred_invoicing'</code> instead of <code>this.deferred_invoicing</code></p>
P粉143640496
P粉143640496

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!