当前位置:网站首页>Elemen when clicking, modify the playback index of the walking lantern
Elemen when clicking, modify the playback index of the walking lantern
2022-07-22 13:20:00 【Anterior cerebellar tiger】
Due to the need of work , Used element Lantern component library , Later, I raised another demand , Used to modify the riding light index , I wish to record
demand : You can click the title number on the right , Jump directly to a topic ?
Code :
element The official provided setActiveItem
Method , Calling this method can change the currently played slide . How to use it is as follows :
Child components
<el-carousel
indicator-position="none" // This page is a sub component
height="70rem"
:autoplay="false"
arrow="never"
ref="cardShow"// The focus is on communication ref
@change="changeIndex"
:loop="false"
>
</el-carousel>
Parent component :
<!-- Part I test questions -->
<div>
<h3> The first part </h3>
<div class="myAnswer">
<div
class="answer"
v-for="(item, index) in solution"
:key="item.serial_num"
:style="BackColor[index] ? BackColor[index].bgColor : ''"
@click="CurrentSelection(index)" // Focus on this click event
>
<div class="noun">{
{ item.serial_num }}</div>
<!-- answer -->
<template>
<div class="Selected">
<div>{
{ onAnswer[index] ? onAnswer[index].choice : "" }}</div>
</div>
</template>
</div>
</div>
</div>
<!-- Part II test questions -->
<div class="selection">
<h3> The second part </h3>
<div class="myAnswer">
<div
class="answer"
v-for="(item, inx) in BackSelection"
:key="inx"
:style="Background[inx] ? Background[inx].bgColor : ''"
@click="myCurrentSelection(item.serial_num)" // Focus on this click event
>
<div class="noun">{
{ item.serial_num }}</div>
<template>
<div class="Selected">
<div>{
{ second[inx] ? second[inx].choice : "" }}</div>
</div>
</template>
</div>
</div>
</div>
js
methods: {
// The second part is the selected topic
myCurrentSelection(e) { // Call ref The method in setActiveItem
this.$refs["examinationQuestions"].$refs.cardShow.setActiveItem(e - 1);
},
// The first part is the selected topic
CurrentSelection(e) { // Call ref The method in setActiveItem
let a =
this.$refs["examinationQuestions"].$refs.cardShow.setActiveItem(e);
console.log("s", a);
console.log(" Current choice ", e);
},
}
The above code test questions and riding lights passed current relation , The point is ref
and setActiveItem
Method .
result :
Click on the title on the right , You can switch to the corresponding topic .
On one page
<div class="bottom-box-right">
<div class="campusDisplay">
<span v-for="(val, key, i) in campusBuildingData" :key="i" :class="{'campus-active':current===i}" @click="changeCampusIndex(i)">{
{key}}</span>
</div>
<el-carousel trigger="click" :interval='5000' arrow="never" @change="changeCampus" ref="remarkCarusel">
<el-carousel-item v-for="(val, key, i) in campusBuildingData" :key="i">
<Bar3D :id="'bottom-box-right-bar3d'+i" width="350px" height="300px" :campusData="val"></Bar3D>
</el-carousel-item>
</el-carousel>
</div>
js
changeCampus (val) {
this.current = val
},
changeCampusIndex (index) {
this.$refs.remarkCarusel.setActiveItem(index)
}
The point is ref
and setActiveItem
Method .
The cover of this issue :
边栏推荐
- 制药机械行业供应链协同管理系统:全链路数字化覆盖,实现产业供应链可视化
- The use of splice method in JS
- uniapp 实现抽奖幸运大转盘功能
- Qt Creator快捷键大全,附快捷键配置方法
- 会员营销怎么做? 3个留住顾客的小秘诀!
- [higher number] prove by definition that the limit of 1/n power of a is 1
- Huawei wireless device configuration attack detection function
- em与rem的区别
- Qt程序打包发布方法(使用官方提供的windeployqt工具)
- 智能仪器仪表行业数字化供应链管理系统:加速企业智慧供应链平台转型
猜你喜欢
利用浏览器插件运行js来删除特定网站“禁用copy”功能
How to wirelessly transmit the liquid level value of asphalt high-level tank to the heat carrier recorder for monitoring?
How to select the type of ankerui intelligent miniature circuit breaker?
MYSQL8存储过程生成日历表以及异常处理
"New energy + energy storage" starts from the digital twin, Tupu will make smart power to the extreme
elemen点击时,修改走马灯的播放索引
超干货!彻底搞懂单工、半双工、全双工的区别与联系
One bite of Stream(8)
Data types and variables
(Applied intelligence-2022) transgait: gait recognition and ensemble transformer based on multimodality
随机推荐
ACL - ijcai - Sigir top Conference Paper Presentation (ais 2022) Note 1: Recommended System
数组和对象的一些方法
Deep understanding of perfect hash
SeekTiger的Okaleido有大动作,生态通证STI会借此爆发?
机器学习-集成学习
Supply chain collaborative management system of pharmaceutical machinery industry: full link digital coverage to realize the visualization of industrial supply chain
Eventlet collaboration
制药机械行业供应链协同管理系统:全链路数字化覆盖,实现产业供应链可视化
JVM parent delegation mechanism
Three methods of JS intercepting strings
: use of class in the project
Why is risc-v architecture gaining momentum
2022/07/18------顺时针打印矩阵
Go list modify element value
[MySQL]数据库基础操作
老薛主机磁盘空间满了怎么办
Qt 使用 Google Breakpad 捕获程序崩溃报告(dump文件)
MYSQL8存储过程生成日历表以及异常处理
webservice接口测试
el-pinut number取消数字操作符号