项目代码格式化:
.prettierrc 文件
“semi”: false,
“singleQuote”: true
}
state 提供唯一公共数据源,所有共享的数据都要同意放到store的state中进行存储
state:{
count:0
}
组件访问State中数据的方式:
一: this.
s
t
o
r
e
.
s
t
a
t
e
.
全
局
数
据
名
称
−
−
−
−
−
−
t
h
i
s
.
store.state.全局数据名称------ this.
store.state.全局数据名称−−−−−−this.store.state.count
{{ $store.state.全局数据名称 }} -----{{ KaTeX parse error: Expected 'EOF', got '}' at position 20: …e.state.count }̲} 二: 1.从 vuex 中…store.commint(‘handlel’)`
第二种方法:
切记:
Action
getter 对数据起包装作用