【uniapp】mescroll-body-part & mescroll-uni-part

这篇文章详细介绍了mescroll-uni组件,一个高性能的用于微信小程序的下拉刷新和上拉加载解决方案,它支持局部滚动和使用flex布局嵌入页面。文中展示了如何在Vue3项目中集成并处理异步数据加载和菜单切换。

在这里插入图片描述 在这里插入图片描述

mescroll.com http://www.mescroll.com/uni.html#load
mescroll-uni_1.3.8_example 高性能下拉刷新上拉加载组件 支持vue3 setup - 插件市场

mescroll-uni-part

<template>
	<!-- mescroll-uni本质是scroll-view,支持局部区域滚动,可使用flex布局灵活的嵌在某个view中 -->
	<!-- mescroll-body只能靠fixed定位其他元素变相实现'局部滚动' -->
	<view class="page-warp">
		<view class="top-warp">
			<view>顶部区域</view>
			<view style="font-size: 24rpx;">mescroll-uni 支持局部区域滚动,支持使用flex嵌在某个view</view>
		</view>
		<view class="center-warp">
			<!-- 左边 -->
			<scroll-view class="left-warp" :scroll-y="true">
				<view class="tab" :class="{active:i==tabIndex}" v-for="(tab,i) in tabs" :key="i" @click="tabChange(i)">{
  
  {tab}}</view>
			</scroll-view>
			<view class="right-warp">
				<!--右边 :fixed="false", 高度跟随父元素 (不在组件上定义class,避免部分小程序平台编译丢失, 如支付宝,钉钉小程序) -->
				<mescroll-uni :fixed="false" @init="mescrollInit" @down="downCallback" @up="upCallback">
					<good-list :list="goods"></good-list>
				</mescroll-uni>
			</view>
		</view>
		<view class="bottom-warp"> 底部区域 </view>
	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
	import {
     
     apiGoods, apiGetTabs} from "@/api/mock.js"
	export<
``` &lt;template&gt; &lt;view&gt; &lt;view class=&quot;sys-head&quot;&gt; &lt;view class=&quot;sys-head-query&quot;&gt; &lt;bus-input ref=&quot;childInputOne&quot; :lblTitleP=&quot;&#39;SN&#39;&quot; :focusP=&quot;true&quot; @inputCallBackEmit=&quot;inputCallBackEmitOne&quot;&gt; &lt;/bus-input&gt; &lt;/view&gt; &lt;view&gt; &lt;view v-for=&quot;(item,index) in snlist&quot; :key=&quot;item,index&quot; class=&quot;sys-body-content-list sys-border&quot;&gt; &lt;view class=&quot;sys-body-content-list-left&quot;&gt; &lt;view class=&quot;sys-body-content-list-left_ft&quot;&gt; &lt;label class=&quot;sys-left-lab&quot;&gt;SN:&lt;/label&gt; &lt;label&gt;{{item.sn}}&lt;/label&gt; &lt;/view&gt; &lt;/view&gt; &lt;view class=&quot;sys-body-content-list-right&quot;&gt; &lt;div class=&quot;sys-right-lab&quot;&gt; &lt;image src=&quot;../../static/img/application/delete.png&quot; style=&quot;height: 50rpx;width: 50rpx;&quot; mode=&quot;aspectFit&quot; @tap=&quot;deleteItem(index)&quot;&gt;&lt;/image&gt; &lt;/div&gt; &lt;/view&gt; &lt;/view&gt; &lt;/view&gt; &lt;/view&gt; &lt;view class=&quot;sys-body body&quot;&gt; &lt;view&gt; &lt;label v-for=&quot;(item, index) in contentList&quot; :key=&quot;item.index&quot;&gt; &lt;view class=&quot;sys-body-content-list sys-border&quot;&gt; &lt;view class=&quot;sys-body-content-list-left&quot;&gt; &lt;view&gt; &lt;label class=&quot;sys-list-ey&quot;&gt;SN{{[contentList.length-index]}}:&lt;/label&gt; &lt;label&gt;{{item.part}}&lt;/label&gt; &lt;/view&gt; &lt;/view&gt; &lt;view class=&quot;sys-body-content-list-right&quot;&gt; &lt;div class=&quot;sys-right-lab&quot;&gt; &lt;image src=&quot;../../static/img/application/delete.png&quot; style=&quot;height: 50rpx;width: 50rpx;&quot; mode=&quot;aspectFit&quot; @tap=&quot;deleteItem(index)&quot;&gt;&lt;/image&gt; &lt;/div&gt; &lt;/view&gt; &lt;/view&gt; &lt;/label&gt; &lt;/view&gt; &lt;/view&gt; &lt;view class=&quot;sys-footer u-f u-f-aic&quot;&gt; &lt;u-button class=&quot;sys-button&quot; type=&quot;primary&quot; @tap=&quot;save&quot;&gt;提交&lt;/u-button&gt; &lt;/view&gt; &lt;/view&gt; &lt;/template&gt; &lt;script&gt; export default { data() { return { //搜索框订单号 parameterOne: &quot;&quot;, //请求参数 params: { shipmentId: &quot;&quot;, code: &quot;&quot; }, //出库单号 shipmentCode: null, //返回数据对象集合 contentList: [], snlist: [] } }, //界面加载完成执行 onLoad(option) { console.log(option) this.params.shipmentId = option.id; // if (option.snlist !== &quot;&quot; || option.snlist !== null) { // const ww = option.snlist.split(&#39;,&#39;) // cons.log(ww) // // if(ww.length){ // // snlist.push(option.snlist) // // } // } //this.$config.setAppTitle(this.$mp.page.route); }, methods: { inputCallBackEmitOne(val) { this.parameterOne = val; if (val != &quot;&quot;) { this.getData() } this.$refs.childInputOne.setInputFocus(); }, //删除 deleteItem(index) { this.contentList.splice(index, 1); }, getData() { if (this.contentList.length &gt;= 8) { this.$wx.showToast({ title: `最多只能绑定8条SN!` }); return } var result = { part: this.parameterOne, } const hasCommonValue = this.contentList.some(item =&gt; item.part === result.part); if (hasCommonValue) { this.parameterOne = &quot;&quot;; this.$refs.childInputOne.cleanInputVal(); this.$refs.childInputOne.setInputFocus(); this.$wx.showToast({ title: `已绑定相同的部件编码【${result.part}】!` }); } else { this.contentList.unshift(result); this.parameterOne = &quot;&quot;; this.$refs.childInputOne.cleanInputVal(); this.$refs.childInputOne.setInputFocus(); } }, save() { var snlistdata = this.contentList.map(item =&gt; item.part).join(&#39;,&#39;); let data = { shipmentDetailId: this.params.shipmentId, snlist: snlistdata, } this.$api.out.shipmentBindSn(data).then(res =&gt; { if (res.data.code == 200) { this.$wx.showToast({ title: &#39;业务数据操作成功!&#39; }); this.clearVal() } }) }, clearVal() { this.parameterOne = &quot;&quot;; this.$refs.childInputOne.cleanInputVal(); this.$refs.childInputOne.setInputFocus(); this.contentList = [] } } } &lt;/script&gt; &lt;style lang=&quot;scss&quot; scoped&gt; .body { //【根据实际情况修改】 padding-bottom: 10rpx; //【根据实际情况修改】 margin-top: 100rpx; } .sys-body-content-list-left_ft { font-size: 38rpx; } &lt;/style&gt;```根据snlist渲染到表格
03-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值