赞
踩
$white: #FFFFFF;
$dark: #000000;
.light {
background: $dark;
color: $white;
}
.dark {
background: $white;
color: $dark;
}
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
vuex_theme: uni.getStorageSync('vuex_theme') ? uni.getStorageSync('vuex_theme') : 'light'
},
mutations: {
changeTheme(state, theme) {
state.vuex_theme = theme;
uni.setStorageSync('vuex_theme', theme);
}
}
})
export default store
import store from '@/store/index'
const app = new Vue({
...App,
store
})
> 直接在页面中使用
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。