State:定义存储状态对象
Getter:获取到State后,对其计算返回需要的值(获取计算状态对象)
Mutation:提交更新状态对象(同步,异步使用:Action)
Action:提交一个或多个Mutation,不是直接变更状态
Module:模块化vuex,可以让每一个模块拥有自己的state、mutation、action、getters,使得结构非常清晰,方便管理。
IT
2022-10-08
2022-10-08
1.安装(如果在创建项目的时候没有确认安装)
1 | cnpm install vue-router --save |
之后在src下会生成一个文件夹router,这里我们删除这个文件夹。(安装好就行了,不用它的默认文件夹,我们自己封装)
2022-10-08
Vue is not defined
在使用HTML button:
1 | <button @click="login()">登录</button> |
出现了错误提示:
1 | Vue is not defined |
解决办法:
2022-10-08
1.安装npm
去Node.js官网下载安装Node.js,npm也就安装上了。
2.安装国内淘宝镜像,以后就可以通过cnpm代替npm指令,使用国内源,执行效率更高:
1 | npm install -g cnpm --registry=https://registry.npm.taobao.org |
2022-10-08
1.卸载旧版本
1 | npm uninstall vue-cli -g |
© 2023 南疆 with help from Hexo and Twitter Bootstrap. Theme by Freemind.