//首页产品库 var vueindexproduct = new vue({ el: '#vue-index-product', delimiters: ['$$', '$$'], data:{ navid:0, //导航id productnavactive:0, //导航高亮 productsnavlist:[], //产品导航列表 productslistdata:[] //产品列表 }, created: function () {//页面初始化后向服务器请求数据渲染 var that = this; //初始化渲染产品导航列表 axios.get("/tools/tbh_submit.ashx?action=getcategory").then(function(res){ that.productsnavlist = res.data },function(err){ console.log(err) }); //初始化渲染产品列表 axios.get("/tools/tbh_submit.ashx?action=screenproducts&category=1").then(function(res){ that.productslistdata = res.data },function(err){ console.log(err) }); }, methods:{ //向服务器产品数据请求 changeproducts:function(navid,index){ //改变导航高亮 this.productnavactive = index //打开加载层 layer.load(2); //请求数据 this.navid = navid; var that = this; axios.get("/tools/tbh_submit.ashx?action=screenproducts&category="+this.navid).then(function(res){ that.productslistdata = res.data //关闭加载层 layer.closeall('loading'); },function(err){ console.log(err) //关闭加载层 layer.closeall('loading'); }) } } }) //首页品牌库 var vueindexproduct = new vue({ el: '#vue-index-brand', delimiters: ['$$', '$$'], data:{ navid:0, //导航id productnavactive:0, //导航高亮 productsnavlist:[], //品牌导航列表 brandlistdata:[] //品牌列表 }, created: function () {//页面初始化后向服务器请求数据渲染 var that = this; //初始化渲染产品导航列表 axios.get("/tools/tbh_submit.ashx?action=getcategory").then(function(res){ that.productsnavlist = res.data },function(err){ console.log(err) }); //初始化渲染品牌列表 axios.get("/tools/tbh_submit.ashx?action=screenbrand&category=1").then(function(res){ that.brandlistdata = res.data },function(err){ console.log(err) }); }, methods:{ //向服务器品牌数据请求 changeproducts:function(navid,index){ //改变导航高亮 this.productnavactive = index //打开加载层 layer.load(2); //请求数据 this.navid = navid; var that = this; axios.get("/tools/tbh_submit.ashx?action=screenbrand&category="+this.navid).then(function(res){ that.brandlistdata = res.data //关闭加载层 layer.closeall('loading'); },function(err){ console.log(err) //关闭加载层 layer.closeall('loading'); }) } } })