欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 游戏 > uniapp实现table排序

uniapp实现table排序

2025/10/27 18:06:08 来源:https://blog.csdn.net/qq_39772439/article/details/140351693  浏览:    关键词:uniapp实现table排序

根据后端接口传来的数字大小对列表进行升序/降序展示 

效果图,价格由高到低降序 

价格由低到高 升序

js  降序升序代码如下

	export default {data() {return {MtList:[]}},onLoad() {this.MtypeName();//加载列表方法},methods: {MtypeName(){//列表方法this.$api.getTypeNameUserID({ctime1:this.ctime3,ctime2:this.ctime4,}).then(res => {//allmoney 金额this.MtList = res.result.sort((a,b)=>b.allmoney-a.allmoney);//降序//this.MtList = res.result.sort((a,b)=>a.allmoney-b.allmoney);//升序})},}

wxml 代码

<view class="typeClassDiv"><view class="typeListClass" v-for="(m,index) in MtList" @click="typeBut(m.typename,m.allmoney,m.bCount)"><image :src="m.typeLogo" class="tyLogo"></image><view class="tyContent"><view class="tytop"><text class='typeNameClass'>{{m.typename}}</text><text class='typeMClass'>{{m.bfb}}%({{m.bCount}}笔)</text></view><view class="tybottom"><view class="progress-box"><progress style="padding-top: 10px;padding-left: 2px;" :percent="m.bfb" stroke-width="3"/></view></view></view><view class="tyFont">¥{{m.allmoney}}</view></view>
</view>

小程序日常记一记 分析页面  可参考

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com