当前位置:网站首页>v-for循环遍历
v-for循环遍历
2022-06-11 18:03:00 【老师好我是大白】
v-for循环遍历
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style> .active{
color: red; } </style>
</head>
<body>
<div id="app">
<h2>万维猫动画</h2>
<ul>
<li v-for="(item, index) in movies" :class="{active: currentIndex === index}" @click="liClick(index)">
{
{item}}
</li>
</ul>
</div>
<!--从CDN引入vue.js-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<script> const app = new Vue({
//初始化一个VUE实例 el: '#app', // 用于页面渲染VUE实例的元素 data: {
// 定义数据 movies: ['凡人修仙传', '斗破苍穹', '秦时明月', '山河剑心', '少年歌行'], currentIndex: 0 }, methods: {
liClick(index) {
this.currentIndex = index } } }) </script>
</body>
</html>

浏览器效果展示

边栏推荐
- IEDA 底层菜单菜单简介
- 使用mysql判断日期是星期几
- EditText 金额限制
- “LSTM之父”新作:一种新方法,迈向自我修正的神经网络
- async导致函数结果出乎意料,改变原来代码的意图;await is only valid in async functions and the top level bodies of modules
- [Golang]力扣Leetcode - 349. 两个数组的交集(哈希表)
- Class question: how to ensure that line table storage can be inserted at any time?
- [C语言]对一个数组的元素排序后平移元素
- Some problems of DC-DC bootstrap capacitor
- Mysql8 installation, Navicat installation, sqli labs setup
猜你喜欢

神经网络与深度学习-2- 机器学习简单示例-PyTorch
![[piecemeal knowledge] [network composition] the mobile phone can be connected to the campus network, but the computer can't](/img/a1/7858a0651ddca0dfd187dc128b2036.jpg)
[piecemeal knowledge] [network composition] the mobile phone can be connected to the campus network, but the computer can't

任意用户密码重置的10种方式

The tle6389 step-down DC-DC switch controller has high efficiency in the whole load range of 1mA to 2.5A - keshijin mall

vim常用命令

Cryptology Summary
![Spring 2021 daily question [week6 not finished]](/img/32/74cff6f057ef9a7941fd6a41dc6635.jpg)
Spring 2021 daily question [week6 not finished]
![[C语言]用结构体按分数高低降序输出学生的姓名和分数](/img/41/b9dba88941560b296f4d7153b7c684.png)
[C语言]用结构体按分数高低降序输出学生的姓名和分数
![Spring 2021 daily question [week3 not finished]](/img/a4/72f2235d014613d26be0fc3524d236.jpg)
Spring 2021 daily question [week3 not finished]
![[Golang]力扣Leetcode - 349. 两个数组的交集(哈希表)](/img/92/03de54c9f08eae5bc920b04d2b8493.png)
[Golang]力扣Leetcode - 349. 两个数组的交集(哈希表)
随机推荐
[FAQs for novices on the road] about project management
SISO decoder for a general (n,n-1) SPC code(補充章節3)
TR-069协议介绍
Several commands related to domain name
Winter vacation daily question 2022 [week1 not finished]
[not forgetting the original intention and forging ahead] 2021 Zhongchuang Suanli new year conference and anniversary celebration
Retrofit source code analysis
[c language] output the average score and the student data below or equal to the average score with the structure
async导致函数结果出乎意料,改变原来代码的意图;await is only valid in async functions and the top level bodies of modules
[c language] limit the number of searches and output the maximum value found in the number of internal searches
高并发架构设计
Why OKR needs to be challenging
【无标题】
Explain AI accelerators in detail: GPU, DPU, IPU, TPU... There are infinite possibilities for AI acceleration schemes
初识企业级平台
[piecemeal knowledge] [network composition] the mobile phone can be connected to the campus network, but the computer can't
Is it good or not to open a stock account on the flush? Is it safe?
[pat grade B question bank] complete summary
網絡安全威脅情報體系
新项目 搭建环境方法