其他分享
首页 > 其他分享> > 组件中监视Vuex的数值

组件中监视Vuex的数值

作者:互联网

<!--
 * @Author: your name
 * @Date: 2021-10-12 08:55:00
 * @LastEditTime: 2021-10-12 13:48:19
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \StructureBiddingSystem_Vue\src\views\SBS\yidingTest\treeTable.vue
-->
<template>
  <div>
    测试组件
  </div>
</template>

<script>
  export default {
    data(){
      return{
        testData:"测试数据",
      }
    },
    computed:{
      projectId(){
        return this.$store.state.projectId
      }
    },
    watch:{
      projectId(newVal,oldVal){
        console.log("监视状态")
        console.log(newVal)
        console.log(this.testData)
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>

标签:testData,console,log,projectId,newVal,监视,组件,return,Vuex
来源: https://blog.csdn.net/weixin_41463944/article/details/120721964