fix: use $index in event args, drop unsupported swiper ref (build success)

This commit is contained in:
2026-09-01 19:46:54 +08:00
parent 331e01cc10
commit 737a32460e
2 changed files with 4 additions and 6 deletions
+3 -5
View File
@@ -1,12 +1,12 @@
<template>
<div class="page">
<swiper class="swiper" ref="swiper" index="{{currentIndex}}" indicator="false" loop="false"
<swiper class="swiper" index="{{currentIndex}}" indicator="false" loop="false"
previousmargin="14px" nextmargin="14px" onchange="onSwipeChange">
<!-- 左页:会话 -->
<div class="page-item left-page">
<text class="page-title">会话</text>
<div class="session-list">
<div class="session-row" for="{{sessions}}" onclick="selectSession({{$index}})">
<div class="session-row" for="{{sessions}}" onclick="selectSession($index)">
<text class="session-title">{{$item.title}}</text>
<text class="session-dot" if="{{$item.running}}">●</text>
</div>
@@ -94,10 +94,8 @@ export default {
},
goTo(index) {
// index 属性绑定已驱动 swiper 切换;此处主要同步 data
this.currentIndex = index
if (this.$refs && this.$refs.swiper && this.$refs.swiper.swipeTo) {
this.$refs.swiper.swipeTo({ index })
}
},
selectSession(index) {
+1 -1
View File
@@ -3,7 +3,7 @@
<text class="title">输入指令</text>
<input class="text-input" type="text" value="{{text}}" placeholder="输入内容..." onchange="onTextChange" />
<div class="quick-list">
<div class="quick-row" for="{{quick}}" onclick="sendQuick({{$index}})">
<div class="quick-row" for="{{quick}}" onclick="sendQuick($index)">
<text class="quick-text">{{$item}}</text>
</div>
</div>