npm install vuex --save(推荐使用淘宝镜像cnpm,具体实施请自行百度)
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state:{
},
actions:{
},
mutations:{
}
})
import store from './store.js'
mutations:{
getJson(){
Vue.http.get('../data.json',{
},{
headers:{},
emulateJSON:true
}).then(response=>{
this.state.newslist=response.data;
},response=>{
})
}
}
actions:{
newJson(obj){
obj.commit('getJson');
}
},
state:{
newslist:[]
},
import {mapState} from 'vuex';
computed:{
...mapState({
goods:state=>state.newslist.goods,
classMap:state=>state.classMap
})
}
{
"goods":[]
}
<ul>
<li v-for="(item,index) in goods" class="menu-item" :class="{'current':currentIndex===index}" @click="selectMenu(index,$event)">
<span class="text border-1px">
<span class="icon" v-show="item.type>0">
</span>
{{item.name}}
</span>
</li>
</ul>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有