js 外部 引用數據路徑問題

if (location.host == “192.168.1.114”) {
var base_url = “http://192.168.1.114/”;
} else {
var base_url = “http://www.godo.com/”;
}
var api = {
/* 分類
列表
*/
levelGoods: base_url + “index/category/levelGoods”,
}

調用

var app = new Vue({
el: “#app”,
data: {
info: “”,/* 商品列表 /
list: “”,/
商品分類名稱 */
},
mounted: function () {
this.view();
},
methods: {
view: function () {
var _this = this;
$.ajax({
url: api.levelGoods,
dataType: “json”,
type: “post”,
success: function (res) {
_this.info = res.data.data;
}
})
},

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章