美文网首页
vue 同时监听多个值的变化

vue 同时监听多个值的变化

作者: jing_bao | 来源:发表于2022-02-18 16:24 被阅读0次

    使用computed 和watch来同时监听多个属性值。。

    data () {
          return {
                links: '',
                categories: ''
          }
     },
    computed: {
          options () {
            const { links, categories } = this
            return { links, categories }
          }
     },
     watch: {
          options :{
             deep:true,
             handler(n,v){
                console.log('n=========>',n);
             }
        }
     }
    

    参考原文:vue 使用watch同时监听多个属性

    相关文章

      网友评论

          本文标题:vue 同时监听多个值的变化

          本文链接:https://www.haomeiwen.com/subject/susylrtx.html