s3e38 v-for

This commit is contained in:
Tyrel Souza 2018-04-13 22:59:43 -04:00
parent 25a3f1612a
commit 250024e34b
No known key found for this signature in database
GPG Key ID: 5A9394D4C30AEAC0
2 changed files with 10 additions and 12 deletions

6
app.js
View File

@ -1,6 +1,10 @@
var app = new Vue({
el: '#app',
data: {
show: true
ingredients: ['meat', 'fruit', 'cookies'],
persons: [
{name: "Max", age: 33, color: "red"},
{name: "Tyrel", age: 30, color: "blue"},
]
}
});

View File

@ -7,17 +7,11 @@
</head>
<body>
<div id='app'>
<button type="button" name="button" @click="show = !show">
Switch
</button>
<p v-if="show">You can see me</p>
<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>
<ul>
<li v-for="ingredient in ingredients">
{{ ingredient }}
</li>
</ul>
</div>
<script src="app.js" charset="utf-8"></script>
</body>