文章复审笔记
文章目录
1.参数里面有类似文章状态(0私密,2公开)好几种的可以用以下方法
<td>{{authstatusFn(item.authstatus)}}</td>
authstatusFn(authstatus){
if (authstatus == -1) {
return '新创建未保存';
} else if (authstatus == 0) {
return '私密';
} else if (authstatus == 1) {
return '部分可见';
}else if (authstatus == 2) {
return '公开';
}
},
2.(1)处理图片可以用这个
<td><img :src="imgUrlCdn(item.userimg)" style="max-width:100px;"></td>
imgUrlCdn(_url) {
if (_url) {
if (_url.indexOf('http://file') != -1) {
return _url.replace("http://file", 'http://upcdn.file');
} else {
return 'https://images.51vv.com/upload/' + _url
}
} else {
return ''
}
},
(2) 裁剪图片用这个
<td><img :src="tailor(data.photo)" style="width:60px;height:60px;" class="item_image"></td>
tailor (url, type) { // 裁剪图片
if (url) {
var changeHead = url.replace("http://file",'http://upcdn.file');
if (type == 1) {
return changeHead
} else {
var suffix = changeHead.split('.')[changeHead.split('.').length-1]
if (suffix == 'png') {
return changeHead+'.cw100.png'
} else if (suffix == 'jpg') {
return changeHead+'.cw100.jpg'
} else if (suffix == 'jpeg') {
return changeHead+'.cw100.jpeg'
} else if (suffix == 'gif') {
return changeHead+'.cw100.gif'
} else {
return changeHead
}
}
} else {
return 'http://upcdn.mpres.51vv.com/image/a52b2ebcf09b9575d80b99b777c4fd25.png'
}
},
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论