wxml代码:
<view>
</view>
<!-- 内容布局 -->
<swiper
class="swiperTtemBox"
bindchange="slideOn"
current="{{tabsId}}"
circular
>
<!-- 首页 -->
<swiper-item skip-hidden-item-layout="{{true}}">
<view wx:if="{{showSwiper === ''}}">
<t-grid class="grid-block" column="{{3}}">
<t-grid-item text="球队" icon="member" />
<t-grid-item text="别名" icon="extension" />
<t-grid-item text="状态" icon="api" />
</t-grid>
<view class="container-swipe-cell">
<block wx:for="{{playerCell}}" wx:key="teamId">
<t-swipe-cell
right="{{right}}"
catchtouchmove="onSwipeTouchMove"
catch:click="onActionClick"
>
<view class="cell-container">
<view class="cell-item">
<p>{{item.name}}</p>
</view>
<view class="cell-item">
<p>{{item.alias}}</p>
</view>
<view class="cell-item">
<t-tag
wx:if="{{item.status}}"
variant="light"
theme="success"
>进行中</t-tag
>
<t-tag
wx:else
theme="warning"
variant="light"
>待开始</t-tag
>
</view>
</view>
</t-swipe-cell>
</block>
</view>
</swiper>
</view>
TS代码:
data: {
// 球队内容
playerCell: [
{
name: "ASYS",
alias: "asys",
status: true,
teamId: 1,
},
{
name: "ASYS1",
alias: "asys2",
status: true,
teamId: 2,
},
],
// 统计内容
statisticsCell: [
{
name: "ASYS",
alias: "asys",
schedule: "9/10",
teamId: 1,
},
{
name: "ASYS1",
alias: "asys2",
schedule: "1/2",
teamId: 2,
},
],
right: [
{
text: "编辑",
icon: {
name: "edit",
size: 16,
},
className: "btn edit-btn",
},
{
text: "开始",
icon: {
name: "play",
size: 16,
},
className: "btn play-btn",
},
],
rightIcon: [
{
icon: "edit",
className: "btn edit-btn",
},
{
icon: "play-circle-stroke",
className: "btn play-btn",
},
],
},
methods: {
slideOn(e: { detail: { current: any } }) {
// 拿到当前索引并动态改变
this.setData({
tabsId: e.detail.current,
});
},
onSwipeTouchMove: function () {
console.log("Swiping t-swipe-cell");
return;
},
tabsOn(e: { currentTarget: { dataset: { idx: any } } }) {
this.setData({
//拿到当前索引并动态改变
tabsId: e.currentTarget.dataset.idx,
});
},
onActionClick({ detail }: any) {
// wx.showToast({ title: `你点击了${detail.text}` });
if (detail.text === "开始") {
this.setData({
showSwiper: "play",
});
} else {
this.setData({
showSwiper: "edit",
});
}
},
onDelete() {
wx.showToast({ title: "你点击了删除", icon: "none" });
},
onEdit() {
wx.showToast({ title: "你点击了编辑", icon: "none" });
},
},
z昨天发现将app.josn中"componentFramework": "glass-easel",去掉后可以进行真机拖动,不确定以上代码片段有没有问题
提供一个能复现的代码片段吧,你这个没法测试操作