const r = Math.floor(Math.random() * 256)
const g = Math.floor(Math.random() * 256)
const b = Math.floor(Math.random() *256 )
创建 一个 rgb 在中央事件总线上 state 中 rgb:'rgb(100,100,100 )',
/* 使用 字符串 拼接的方式 */
this.$store.commit('bian', `rgb(${r} , ${g} ,${b})` )
在 mutations 中 进行 操作 赋值
jia(state , val ){
state.shu.push(val)
}
在 需求的 位置 绑定 :style="{'backgroundColor' : $store.state.rgb}" 就可以啦