<template>
    <div>
        <span> 这是一个组件 </span>
        <button @click="change">22</button></div>

</template>

<script>
    import {mapState,mapMutations} from 'vuex'
  export default {
    name: "TagTextarea",
    computed:{
      // themeColor () {
      //   return this.$store.state.moduleNews1.themeColor;
      // }
      ...mapState('moduleNews1',['themeColor'])
    },
    watch: {
      themeColor: {
        handler(newValue) {
          console.log('哈哈哈哈哈')
          console.log(newValue)
        },
        // 代表在wacth里声明了firstName这个方法之后立即先去执行handler方法
        immediate: true
      },
    },
    created() {
      console.log('******************');
      console.log(this.themeColor)
      console.log('******************');
    },
    methods: {
      ...mapMutations('moduleNews1',['setCardConfig']),
      change() {
        console.log('哈哈哈哈');
        console.log(this);
        this.setCardConfig('vvv')
        // this.$store.commit('setCardConfig', 'vvv');
      }
    }
  }
</script>

<style scoped>
    span {
        color: red;
    }

</style>