<template> <view class="content"> <view class="itemtop" v-for="(item,index) in toplist"> <view class="oneitem_img"> <image :src="aaa(item.avator)"></image> </view> <view>{{index+1}}.{{item.name}}</view> <view>{{item.score}}分</view> </view> </view> </template> <script> export default { data() { return { searchKey: '', title: 'Hello', toplist: [], //存前3名数据 sublist: [], //存第4名往后的数据 userlist: [] //存所有用户数据 }; }, onLoad() { ///一堆代码 }, methods: { aaa(avator) { if (avator == '') { return "http://www.niunan.net/images/defaultface.jpg"; } else { return "http://124.222.23.214:8889" + avator; } }, } }; </script>
标签:SRC,return,前缀,image,item,http,avator From: https://www.cnblogs.com/niunan/p/17470473.html