跳至主要內容

Behavior

Mr.Hope...小于 1 分钟小程序

Behavior 注册一个 behavior,接受一个 Object 类型的参数。

参数

定义段类型是否必填描述
propertiesObject Map同组件的属性
dataObject同组件的数据
methodsObject同自定义组件的方法
behaviorsString Array引入其它的 behavior
createdFunction生命周期函数
attachedFunction生命周期函数
readyFunction生命周期函数
movedFunction生命周期函数
detachedFunction生命周期函数
代码示例
// my-behavior.js
module.exports = Behavior({
  behaviors: [],
  properties: {
    myBehaviorProperty: {
      type: String,
    },
  },
  data: {
    myBehaviorData: {},
  },
  attached() {},
  methods: {
    myBehaviorMethod() {},
  },
});
评论
  • 按正序
  • 按倒序
  • 按热度
Powered by Waline v3.1.3