0
点赞
收藏
分享

微信扫一扫

VueJS(4)---图片绑定


1、加载数据

public String detail() {        
jsonRoot.put("data", service.detail(ad.getId() == null ? -1 : ad.getId()));
jsonRoot.put("success", true);
return SUCCESS;
}

2、请求数据
1)主页点击标题跳转到明细:

<a href="javascript:void(0)" v-html="d.title" v-on:click="popupDetail(d)"></a>

2)实现方法

popupDetail: function (row) {
var thisVue = this;
thisVue.detailData = {};

$.ajax({
url: base + "/ad/detail.do?ad.id=" + row.id,
type: "post",
success: function (res) {
if (res.success && res.data) {
thisVue.detailData = res.data;
}
}
});

$("#popup_detail").modal();
},

3、在明细页面显示

<img v-bind:src="detailData.imagePath"/>

举报

相关推荐

0 条评论