vue 組件 Vue.component 用法

定義: 組件是可複用的 Vue 實例,且帶有一個名字 可以在一個通過 new Vue 創建的 Vue 根實例中,把這個組件作爲自定義元素來使用 1. 定義一個新組件。命名爲 counter 格式: 1.組件名爲"conter"; 2.data 數據屬性:寫函數; 3.template 模板:寫組件的內容(元素和觸發的事件) Vue.component("counter",{ //1.組件名爲
相關文章
相關標籤/搜索