<scroll-view scroll-x="true" scroll-into-view="today">
<view class="list">
<view
:id="item.date === today ? 'today' : ''"
class="item"
:class="[item.date === curDate ? 'cur' : '', item.date === today ? 'today' : '']"
:key="idx"
v-for="(item, idx) in list" @click="switchDate(item.date)">
<view class="week">{{item.weekName}}</view>
<view class="date">
<view class="num">{{item.date !== today ? item.day : '今'}}</view>
</view>
</view>
</view>
</scroll-view>
- 发布:2022-04-11 15:31
- 更新:2023-10-01 16:53
- 阅读:580
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: window10 64
HBuilderX类型: 正式
HBuilderX版本号: 3.3.13
第三方开发者工具版本号: 1.05
基础库版本号: 2.23.4
项目创建方式: HBuilderX
示例代码:
操作步骤:
<scroll-view scroll-x="true" scroll-into-view="today">
<view class="list">
<view
:id="item.date === today ? 'today' : ''"
class="item"
:class="[item.date === curDate ? 'cur' : '', item.date === today ? 'today' : '']"
:key="idx"
v-for="(item, idx) in list" @click="switchDate(item.date)">
<view class="week">{{item.weekName}}</view>
<view class="date">
<view class="num">{{item.date !== today ? item.day : '今'}}</view>
</view>
</view>
</view>
</scroll-view>
<scroll-view scroll-x="true" scroll-into-view="today">
<view class="list">
<view
:id="item.date === today ? 'today' : ''"
class="item"
:class="[item.date === curDate ? 'cur' : '', item.date === today ? 'today' : '']"
:key="idx"
v-for="(item, idx) in list" @click="switchDate(item.date)">
<view class="week">{{item.weekName}}</view>
<view class="date">
<view class="num">{{item.date !== today ? item.day : '今'}}</view>
</view>
</view>
</view>
</scroll-view>
预期结果:
id="today"
id="today"
实际结果:
实际打包后 id="edd00d78--today"
实际打包后 id="edd00d78--today"
bug描述:
标签元素 绑定的id 属性 会被追加一串随机数 id="edd00d78--today" 导致scroll-into-view="today" 失效