1.第一种使用script标签
从事资阳服务器托管,服务器租用,云主机,网络空间,域名注册,CDN,网络代维等服务。
hello look test component!
注意:使用
当然,如果template内容少的话,我们可以直接在组件中书写,而不需要用template标签。像下面这样:
Vue.component('test-component',{ template:`this is test,{{test}}
`, data(){ return{ test:"hello test" } } })
3.第三种 单文件组件
这种方法常用在vue单页应用中
创建.vue后缀的文件,组件Hello.vue,放到components文件夹中
app.vue{{ msg }}
![]()
以上就是Vue组件模板的几种书写形式(3种)的详细内容,更多关于Vue 组件模板请关注创新互联其它相关文章!
Copyright © 2009-2022 www.kswsj.com 成都快上网科技有限公司 版权所有 蜀ICP备19037934号