javascript - Vue.component的問題,幫忙解答~
给我你的怀抱
给我你的怀抱 2017-05-31 10:41:32
0
1
604

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學習者快速成長!