Below I will share with you a summary of the four writing methods of Vue2 template template. It has a good reference value and I hope it will be helpful to everyone.
is as follows:
<p id="app"> <h1>我是直接写在构造器里的模板1</h1> </p> <template id="demo3"> <h1 style="color:red">我是选项模板3</h1> </template> <script type="x-template" id="demo4"> <h1 style="color:red">我是script标签模板4</h1> </script> <script> var vm=new Vue({ el:"#app", data:{ message:1 }, //第2种模板 写在构造器里 //template:`<h1 style="color:red">我是选项模板2</h1>` //第3种模板 写在<template>标签里 //template:'#demo3' //第4种模板 写在<script type="x-template">标签里 template:'#demo4' }) </script>
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
How to build element-ui (detailed tutorial)
##How to modify the default style in elementui
Use elementUI to implement custom theme methods in Vue
The above is the detailed content of How to use template in Vue2 template. For more information, please follow other related articles on the PHP Chinese website!