后端是php页面部分用后端模板套 部分用vue,用后端模板的界面可以打开,用vue的都不行,怎么回事!!!
new Vue({
el: '#app',
data() {
return {
getSortListUrl: "/Lease/Api/Product/getCategoryList",
getCategoryInfoUrl: '/Lease/Api/Product/getCategoryInfo',
getProListByCatUrl: '/Lease/Api/Product/getProListByCat',
sortlist: [],
sortdetail: '',
tabproductlist: [],
productlist:[],
selectItem: 0,
sortid:'',
page:1,
indexid:'',
categoryName:'',
userId:1
}
},
created() {
this.getId();
this.getSortList();
},
methods: {
getId() {
var that = this;
var index = window.location.href.indexOf('/index');
console.log(index);
sessionStorage.setItem("user_id",that.userId);
var user_id = sessionStorage.getItem("user_id");
console.log(user_id);
if(index == -1)
that.indexid = '';
else {
var id = window.location.href.slice(index+7);
that.indexid = id;
console.log(that.indexid);
}
},
getSortList() {
var that = this;
that.$http({
url: that.getSortListUrl,
methods: 'GET'
})
.then(function(response) {
var rtnData = response.data;
that.sortid = rtnData.data[0].id;
console.log(that.sortid);
if(rtnData.code == 200) {
that.sortlist = rtnData.data;
that.getCategoryInfo(this.sortid, 0);
if(that.indexid ==""){
that.getProListByCat(that.sortid,1,3);
console.log(that.indexid);
}else{
that.getProListByCat(that.indexid,1,3);
}
}
}, function(error) {
//error
console.log(error);
})
},
首先你可以先用谷歌的手机模拟器查看下能不能访问,可以把代码贴出来不然不好排查问题所在