You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
728 B
28 lines
728 B
import { mapState } from 'vuex' |
|
import store from "@/store" |
|
let StoreKey = []; |
|
try{ |
|
StoreKey = store.state ? Object.keys(store.state) : []; |
|
}catch(e){ |
|
|
|
} |
|
|
|
module.exports = { |
|
beforeCreate() { |
|
// 将vuex方法挂在到$u中 |
|
// 使用方法为:如果要修改vuex的state中的user.name变量为"史诗" => this.$u.vuex('user.name', '史诗') |
|
// 如果要修改vuex的state的version变量为1.0.1 => this.$u.vuex('version', '1.0.1') |
|
this.$u.vuex = (name, value) => { |
|
this.$store.commit('$uStore', { |
|
name,value |
|
}) |
|
} |
|
}, |
|
computed: { |
|
// BetLoading() { |
|
// return this.$refs.BetLoading |
|
// }, |
|
// 将vuex的state中的所有变量,解构到全局混入的mixin中 |
|
...mapState(StoreKey), |
|
} |
|
} |