查看当前镜像
npm get registry
设置为淘宝镜像
npm config set registry https://registry.npm.taobao.org/
官方镜像
npm config set registry https://registry.n...
4年前 (2021-09-02)
喜欢
查看当前镜像
yarn config get registry
设置为淘宝镜像
yarn config set registry https://registry.npm.taobao.org/
设置为官方镜像
yarn config set registry https:/...
4年前 (2021-09-02)
喜欢
Yarn是什么?
...
4年前 (2021-09-02)
喜欢
Yarn是什么?
“Yarn是由Facebook、Google、Exponent 和 Tilde 联合推出了一个新的 JS 包管理工具 ,正如官方文档中写的,Yarn 是为了弥补 npm 的一些缺陷而出现的。”这句话让我想起了使用npm时的坑了:
npm install的时候慢。...
4年前 (2021-09-02)
喜欢
Actions用于处理异步任务
如果通过异步操作变更数据,必须通过 Action,而不能使用Mutation,但是在 Action中还是要通过触发Mutation的方式间接变更数据。
在Actions 中不能直接修改 state中的数据,要通过 mutations修改。
disp...
4年前 (2021-09-02)
喜欢
Mutations
Mutations用于修改Store中的数据
注意
只有 mutations里的函数,才有权利修改 state 的数据
mutations里不能包含异步操作。
定义mutations方法
只能通过 mutations变更 Store数据,不可以直接操作 Sto...
4年前 (2021-09-01)
喜欢
State提供唯一的公共数据源,所有共享的数据都要统一放到 Store的 State 中进行存储。
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export defau...
4年前 (2021-09-01)
喜欢
main.js
import Vue from 'vue'
import App from './App.vue'
import store from './store'
Vue.config.productionTip = fa...
4年前 (2021-09-01)
喜欢
一般情况下,只有组件之间共享的数据,才有必要存储到vuex中;对于组件中的私有数据,依旧存储在组件自身的 data 中即可。
...
4年前 (2021-09-01)
喜欢
能够在 vuex 中集中管理共享的数据,易于开发和后期维护
能够高效地实现组件之间的数据共享,提高开发效率
存储在vue义中的数据都是响应式的,能够实时保持数据与页面的同步
...
4年前 (2021-09-01)
喜欢