老师,我这怎么没反应?也没有报错?

来源:2-22 状态管理vuex

你要去哪

2020-01-23 05:37:00

// The Vue build version to load with the `import` command

// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import Vue from 'vue'

import App from './App'

import router from './router'

import store from './store'


Vue.config.productionTip = false


/* eslint-disable no-new */

new Vue({

  el: '#app',

  router,

  store,

  components: { App },

  template: '<App/>'

})



<template>

<div>

<div>状态管理</div>

<div>---------------------</div>

<div>{{msg}}</div>

<button @clic="change">change</button>

</div>

</template>

<script>


export default{

data(){

return{ 

      msg:"123"

      }

   },

   methods:{

   change(){

   //vuex取数据

       //this.msg=this.$store.state.count;

   //修改公共数据    

       this.$store.dispatch('inc',100000);

       this.msg=this.$store.state.num;


     }

   }

}

</script>


写回答

1回答

好帮手慕星星

2020-01-23

同学你好,点击事件没有绑定正确,导致没有效果,参考修改:

http://img.mukewang.com/climg/5e2931350976282d05310077.jpg

如果我的回答帮到了你,欢迎采纳,祝学习愉快~

0

0 学习 · 10739 问题

查看课程