vue v | 您所在的位置:网站首页 › img标签src变量拼接 › vue v |
刚接触vue,v-for中获取字段都很正常,但是中的路径不知道怎么拼接。还是我张哥出马,一个赶俩。废话少说直接上代码。 在vm实例中的data加上url:window.fileUrl,获取路径,然后在拼接。 vue {{item.name}} {{item.address}} var vm = new Vue({ el: '#peoples', data: { peopleArr:[], url:window.fileUrl //获取图片的路径前缀 }, mounted:function(){ this.initInfo('1') }, methods:{ initInfo:function(){ let self = this; $.ajax({ async: true, url: window.serverUrl+'/lxtz/lxtzpeople/getPeople', method: 'get', dataType: 'JSON', /* data:{ "categoryCode":'' }, */ success: function (res) { self.peopleArr = res.data console.log(res.data) }, error: function (data) { if (data.status == 0) { parent.layer.close(parent.layer.index); } } }); }, Lclick(msg){ window.open('people.html?rowGuid='+msg); console.log(msg); } }, })
|
CopyRight 2018-2019 实验室设备网 版权所有 |