1.目錄結構
demo-one 和 demo-two 一起公用一些屬性 和 方法 存在demo-beh.js中
需要像模塊一樣導出
2.調用的方法:
// components/demo-class/demo-one/index.js import { demoBeh } from '../demo-beh.js' Component({ /** * 組件的屬性列表 */ properties: { }, // 多繼承 behaviors: [demoBeh], attached:function(){ // 通過behaviors繼承時 不會覆蓋 會依次執行 }, /** * 組件的初始數據 */ data: { }, /** * 組件的方法列表 */ methods: { } })