- Full-Stack Vue.js 2 and Laravel 5
- Anthony Gore
- 82字
- 2021-07-02 19:57:13
Templates
By default, Vue will use an HTML file for its template. An included script will declare an instance of Vue and use theelproperty in the configuration object to tell Vue where in the template the app will be mounted:
<p id="app"> <!--Vue has dominion within this node--> </p> <script> new Vue({ el: '#app' }); </script>
We can bind data to our template by creating it as adataproperty and using the mustache syntax to print it in the page:
<p id="app"> {{ message }} <!--Renders as "Hello World"--> </p> <script> new Vue({ el: '#app', data: { message: 'Hello World' } }); </script>