当前位置:网站首页>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>

浏览器效果展示

边栏推荐
- [not forgetting the original intention and forging ahead] 2021 Zhongchuang Suanli new year conference and anniversary celebration
- Upload labs failed to pass the customs halfway and the middle road collapsed
- 10 ways to reset any user password
- LeetCode_前缀树_中等_208. 实现 Trie (前缀树)
- 金融银行_催收系统简介
- SQL error injection 1
- 论催收系统的管理子系统选型设计
- Getting started with CTF
- 软件测试技术复习
- Easycwmp source code analysis
猜你喜欢
随机推荐
v-for中的key的作用和原理
[piecemeal knowledge] [network composition] the mobile phone can be connected to the campus network, but the computer can't
EasyCwmp源码分析
神经网络与深度学习-2- 机器学习简单示例-PyTorch
Reading summary of nacos2.x source code
Can 400 fans earn 20W a month? How did you do it?
[FAQs for novices on the road] about project management
[practical Script] obtain the line number of a file, and then delete the file content.
IEDA 底层菜单菜单简介
Spring 2021 daily question [week3 not finished]
PIL-Pillow图像处理【1】-安装与新建
Common shortcut keys for Hello go (x) and GoLand
论工作流选型
Codeworks round 479 (Div. 3) [done]
Why OKR needs to be challenging
LeetCode_ Prefix tree_ Medium_ 208. implement trie (prefix tree)
NR LDPC 打孔-punctured
下载代码,并编译环境的问题
Various poses for text modification using sed
【新手上路常见问答】关于项目管理





![[golang] leetcode - 349 Intersection of two arrays (hash table)](/img/92/03de54c9f08eae5bc920b04d2b8493.png)


![[C语言]限制查找次数,输出次数内查找到的最大值](/img/e6/cbb8dd54b49ade453251a70c8455e8.png)
