获取数据写方法里,请求写在生命周期事件里。试试
//家具
var rosewoodFurniture = new Vue({
el: '#rosewoodFurniture',
data: {
id: '',
Title: '', Introduction: '', Craftwork: '', Specifications: '', Culture: '',
Material: '', ProductionPlace: '', TakePlace: '',
},
methods: {
//加载数据
Load: function (data) {
this.Title = data.Title;
this.Introduction = data.Introduction;
this.Craftwork = data.Craftwork;
this.Specifications = data.Specifications;
this.Culture = data.Culture;
this.Material = data.Material;
this.ProductionPlace = data.ProductionPlace;
this.TakePlace = data.TakePlace;
// 触发组件 A 中的事件
bus.$emit('setdetail', data.Details)
// 触发组件 A 中的事件
bus.$emit('setimages', data.Images)
},
//获取数据
Get: function () {
Api.Show.RosewoodFurniture.Single(this.Load,{ id: this.id });
},
},
mounted: function () {
this.id = $.GetUrlParam('Id');
this.Get();
}
})