javascript - Vue.component的问题,帮忙解答一下~
给我你的怀抱
给我你的怀抱 2017-05-31 10:41:32
0
1
601

Vue.component(name,obj);
我看vue官网上市这样写的
Vue.component('my-component', {
template: '<p>A custom component!</p>'
})
注册一个全局的模板,<my-component><my-component>

能不能不直接在template写代码,
而是引用写好的.vue文件。做my-component的template??? 能的话 要怎么写???

给我你的怀抱
给我你的怀抱

全部回复(1)
漂亮男人

1.官网上的代码使用于前端非工程化开发中,比较简单的模式

2.进阶的话,也就是使用vue文件,进行编译咯哟。更多参考vue-cli 生成的 template

import Hello from "./hello.vue";

hello.vue

<template>
<p></p>
</template>
<script></script>
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!