<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title> </head>
<body>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vuex@3.0.1/dist/vuex.js"></script>
<div id="app">
<p>{{count}}
<button @click="inc">+</button>
<button @click="dec">-</button>
</p>
</div>
<script> const store = new Vuex.Store({
state: {
count: 0
},
mutations: {
inc: state => state.count++,
dec: state => state.count--
}
}) const app = new Vue({
el: '#app',
computed: {
count () {
return store.state.count
}
},
methods: {
inc () {
store.commit('inc')
},
dec () {
store.commit('dec')
}
}
})
</script> </body>
</html>

最新文章

  1. 网页日历显示控件calendar3.1
  2. lintcode 最长上升连续子序列 II(二维最长上升连续序列)
  3. 关于session和token
  4. jsp学习笔记一
  5. C#注意事项及错误处理
  6. Python学习(1)安装Python
  7. Android Service 生命周期和使用注意项
  8. 【deep learning学习笔记】注释yusugomori的LR代码 --- 模型测试
  9. PHP中GD库安装
  10. hibernate中Query的list和iterator区别
  11. org.springframework.web.filter.DelegatingFilterProxy的作用
  12. Linux- 常用命令, Vim编辑器操作
  13. linux执行jmeter脚本解决响应数据为空
  14. 重写TreeView模板来实现数据分层展示(一)
  15. [No0000127]WCF安全体系netTCPBinding绑定
  16. spring管理hibernate,mybatis,一级缓存失效原因
  17. $()与document.getElementById
  18. &lt;浪潮之巅&gt;读书笔记
  19. HDU4388:Stone Game II(博弈+思维)
  20. jquery 获取绑定事件

热门文章

  1. 关闭chrome浏览器的input香蕉黄背景
  2. luoguP1040 区间DP(记忆化 加分二叉树
  3. vue-cli脚手架每行注释--摘抄
  4. 视音频数据处理入门:RGB、YUV像素数据处理【转】
  5. hdu3338 / 方格横纵和问题终极版,最大流斩
  6. 富文本ZSSRichTextEditor之趟坑集锦
  7. BZOJ 3309 莫比乌斯反演
  8. django删除表重建&amp;修改用户密码&amp;base64加密解密字符串&amp;ps aux参数说明&amp;各种Error例子
  9. CDOJ 3 BiliBili, ACFun… And More! 模拟
  10. OAuth 2.0 in Web API #Reprinted