1.当文字超过一行显示省略号和下拉箭头( 之前是通过css 来控制的,发现并不好使,就改用函数)
图一是正常,不超过一行显示的,图二是超过,也就是想要的效果,图三是点击箭头显示全部,主要是通过字数来控制的
<text v-if="key == 'isShow">{{ellipsisText(info)}}</text>
<text v-else class="inline">{{info}}</text>
<text v-if=" isShow && info.length>16" class="iconfont icon-fanhui2-copy icon_up" @tap="isClickShow(info)"></text>
//点击事件
isClickShow(info){
this.isShow = !this.isShow;
},
ellipsisText(info){
console.log(info.length);
if(this.isShow && info.length > 16){
return info.slice(0,15) + '...';
}else{
return info;
}
}
2. 后台数组(GET)需要接受数组, 需要用encodeURIComponent处理一下JSON.stringify之后的值,如下图所示:
let orderFields = [{"fieldName":"read_status","orderType":"ASC"},{"fieldName":"create_time","orderType":"DESC"}];
http(`/pani-core/message/query/list?orderFields=${encodeURIComponent(JSON.stringify(orderFields))}&enablePage=true&pageNum=${+this.currentPage+1}`, 'GET', null, (res) => {
if(res.success) {
console.log(xxxx)
}
})