s3e38 v-for
This commit is contained in:
parent
25a3f1612a
commit
250024e34b
6
app.js
6
app.js
@ -1,6 +1,10 @@
|
|||||||
var app = new Vue({
|
var app = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
data: {
|
data: {
|
||||||
show: true
|
ingredients: ['meat', 'fruit', 'cookies'],
|
||||||
|
persons: [
|
||||||
|
{name: "Max", age: 33, color: "red"},
|
||||||
|
{name: "Tyrel", age: 30, color: "blue"},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
16
index.html
16
index.html
@ -7,17 +7,11 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id='app'>
|
<div id='app'>
|
||||||
<button type="button" name="button" @click="show = !show">
|
<ul>
|
||||||
Switch
|
<li v-for="ingredient in ingredients">
|
||||||
</button>
|
{{ ingredient }}
|
||||||
|
</li>
|
||||||
<p v-if="show">You can see me</p>
|
</ul>
|
||||||
<p v-else>Now you see me</p>
|
|
||||||
<template v-if="show">
|
|
||||||
<h1>Heading</h1>
|
|
||||||
<p>Inside a template</p>
|
|
||||||
</template>
|
|
||||||
<p v-show="show">Do you also see me?</p>
|
|
||||||
</div>
|
</div>
|
||||||
<script src="app.js" charset="utf-8"></script>
|
<script src="app.js" charset="utf-8"></script>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user