uni-app中Vuex的引用
2024-09-01 01:02:51
//store 中 store.js
import Vue from 'vue'
import Vuex from 'vuex' Vue.use(Vuex) const store = new Vuex.Store({
state: {
author: 'Youngmon'
},
mutations: {
author(state, newName) {
state.author = newName;
}
},
actions: { }
}) export default store /**
//main.js 新增
import store from './store'
Vue.prototype.$store = store //demo.vue
this.$store.commit("author","yongmao"); computed: {
author() {
return this.$store.state.author
}
} */
最新文章
- 使用复合设计模式扩展持久化的CURD,Select能力
- PHP中的回调函数和匿名函数
- paip.自适应网页设计 跟 响应式 设计的区别跟原理and实践总结
- AndroidStudio支持新的NDK的操作使用
- OpenFileDialog组件打开文件....待续
- SQL Server tables export/import with bcp
- 我理解的javascript单线程机制
- 纯css3实现tab选项卡
- android4.0下载问题
- mybatis 自动生成代码(mybatis generator)
- [java语言]——InetAddress类的getByName()方法
- 团队作业7——第二次项目冲刺(Beta版本)
- 解决git反复输入密码的问题
- DOSBOX的安装和使用(window10 64位)
- 《锋利的jQuery》笔记:插件的使用和写法
- BGP 优选短的AS号路径实践总结
- Spark安装与介绍
- Maven支撑下的War应用依赖另外一个WAR应用的解决方案
- APP-4-百度地图定位
- Python高级知识点总结
热门文章
- 一款有意思的 Qt 飞行仪表控件
- 优秀开源项目之四:CrashRptProbe,查询程序奔溃的利器
- [Swift]UIAlertController 以及 Swift 中的闭包和枚举
- crossplatform---Nodejs in Visual Studio Code 01.简单介绍Nodejs
- 使用 install.packages() 安装所需的包
- 圆周卷积(circular convolution)
- Matlab随笔之分段线性函数化为线性规划
- eclipse 配置maven tomcat 环境
- VS发布到IIS Express外网Debug(如微信开发)
- JS顶级对象window