November 2019
Beginner
804 pages
20h 1m
English
Vue uses the concept of directives; these are similar to Angular directives. Just like Angular, Vue provides a set of built-in directives.
The following is an example of how to bind a value to an element attribute using the built-in v-bind directive:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Bind me!</title>
<!-- development version of Vue.js -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
<input type="text" v-bind:placeholder="defaultMessage">
</div>
<script type="text/javascript">
let app = new Vue({
el: '#app',
data: {
defaultMessage: 'Username'
}
});
</script>
</body>
</html>
Another built-in directive, called v-if, allows us to conditionally ...
Read now
Unlock full access