组件中监视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>
上一篇:Cypress系列(64)- 数据驱动策略


下一篇:Matlab:将数据按比例随机划分