vue元件包括兩種:1 .全域性元件,2 .區域性元件
區域性元件var 變數名字一定要放在new vue例項外面
1 .全域性元件:
全域性元件直接像上面這樣 註冊 就可以 如果還想註冊繼續vue.component(標籤名字,
text-align: center;
color: red;
font-size: 20px;
margin-top: 20px;
}
區域性元件註冊要先var變數,變數在vue例項外面申請 然後再例項vue裡components: {
"標籤名字":區域性元件變數名字
使用方法也是在根元素裡面《標籤名》
vue 全域性元件和區域性元件
vue.component mycpn cpnc components html lang en head meta charset utf 8 title document title script src js vue.js script head div id mycpn div div id...
Vue 元件(一)全域性元件和區域性元件
根據vue官方文件 元件 component 是vue.js最強大的功能之一。元件可以擴充套件html元素,封裝可重用的 在較高層面上,元件是自定義元素。按我當前學習程度的理解,元件就是定義乙個自己的新標籤,新標籤可以在html 中使用。全域性宣告元件 vue.component my compon...
VUE註冊全域性元件和區域性元件
全域性元件 第一步 在components資料夾下建立乙個子檔案users.vue class users 第二步 在main.js中進行全域性註冊 the vue build version to load with the import command runtime only or stand...