Blogger Information
Blog 250
fans 3
comment 0
visits 321674
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Vue.Js自学:循环和遍历数组+列表的展示
梁凯达的博客
Original
889 people have browsed it

<!DOCTYPE html>

<html lang="zh">

<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Vue.js自学:循环和遍历数组+列表的展示</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
<div id="app">
<ul>
<li v-for="item in movies">{{item}}</li>
</ul>
</div>
</body>
<script type="text/javascript">
//JS中数组写法和PHP一致,为[‘arr’,’arr’]
//const是常量的意思,JS/ES8中不建议使用Var 建议使用let定义变量
//el是绑定的意思
//v-for是循环遍历数组的意思
//核心写法:item in arr_name
//遍历结果为{{item}}
const app = new Vue({
el: ‘#app’,
data: {
message: ‘这只是一个基础的信息’,
movies: [‘海贼王’,’火影忍者’,’全职猎人’,’七龙珠’]
}
})
</script>

</html>

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post