<!--第五个vue程序,如何用vue实现循环结构for-->
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<!--view层 模板-->
<div id="app">
<li v-for="(item,index) in items">
{{item.message}} --- {{index}}
</li>
</div>
<!--导入vue.js-->
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"></script>
<script>
var vm = new Vue({
el: "#app",
data: {
items: [
{message: "Java"},
{message: "Go"},
{message: "Python"}
]
}
});
</script>
</body>
</html>
第五个vue程序,如何用vue实现循环结构for
最新推荐文章于 2022-06-27 10:01:13 发布