const app1 = new Vue({
// #app is a selector for our Vue app container
el: '#app',
// data is always a function that returns the initial state
data() {
// message is an observable value
// and will update the UI when changed
return { message: 'Hello world!' };
},
methods: {
reverse() {
// access data observables using 'this'
this.message = this.message.split('').reverse().join('');
}
}
});
Message: {{ message }}
12 x 12 = {{ 12 * 12 }}
0.1 + 0.2 != {{ 0.1 + 0.2 }}
Message: {{ message ? message : 'Default Message' }}
Message: {{ message }}
12 x 12 = {{ 12 * 12 }}
0.1 + 0.2 != {{ 0.1 + 0.2 }}
Message: {{ message ? message : 'Default Message' }}
My title
Some text content
Admin Panel
Homepage
<p v-else>Login</p>
Admin Panel
Homepage
Login
- {{ item }}
<script>
app5 = new Vue({
el: '#app5',
data() {
return {
clickCount: 0,
enterCount: 0
};
},
methods: {
reset() {
this.clickCount = 0;
this.enterCount = 0;
}
}
});
</script>
Hello {{ name }}!
<script>
app6 = new Vue({
el: '#app6',
data() {
return {
count: 0,
name: 'world'
};
}
});
</script>