vue列表
阿新 • • 發佈:2020-08-28
一、例項二:vue列表顯示
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="js/vue.js"></script>
</head>
<body>
<ul>
<li id="flowers">{{flowers}}</li>
</ul>
<script>
const app = new Vue({
el:'#flowers',
data:{
flowers:['向日葵','雛菊','蒲公英','月季']
}
})
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="js/vue.js"></script>
</head>
<body>
<ul id="flowers">
<li>{{flowers[0]}}</li>
<li>{{flowers[1]}}</li>
<li>{{flowers[2]}}</li>
<li>{{flowers[3]}}</li>
</ul>
<script>
const app = new Vue({
el:'#flowers',
data:{
flowers:['向日葵','雛菊','蒲公英','月季']
}
})
</script>
</body>
</html>