标签:for循环 sage script npm 判断 循环 div pre its
<div id="app">
<h1 v-if="type==='A'">aaaaa</h1>
<h1 v-else-if="type==='B'">bbbbb</h1>
<h1 v-else>ccccc</h1>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js"></script>
<script>
var vm = new Vue({
el: "#app",
data: {
type: 'B'
}
});
</script>
<div id="app">
<li v-for="item in fruits">
{{item.message}}
</li>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.min.js"></script>
<script>
var vm = new Vue({
el: "#app",
data: {
fruits: [
{message: '苹果'},
{message: '香蕉'},
{message: '菠萝'}
]
}
});
</script>
标签:for循环 sage script npm 判断 循环 div pre its
原文地址:https://www.cnblogs.com/pinked/p/12310437.html