# Behavior(Object object)
Register a behavior
Accept one. Object
Parameter of type.
# parameter
# Object object
Definition segment | type | Is it necessary to fill out | describe | Minimum version |
---|---|---|---|---|
properties | Object Map | no | Properties of the same component | |
data | Object | no | Data of the same component | |
methods | Object | no | Methods with custom components | |
behaviors | String Array | no | Introduce other behavior | |
created | Function | no | Life cycle function | |
attached | Function | no | Life cycle function | |
ready | Function | no | Life cycle function | |
moved | Function | no | Life cycle function | |
detached | Function | no | Life cycle function |
Code example:
// my-behavior.js
module.exports = Behavior({
behaviors: [],
properties: {
myBehaviorProperty: {
type: String
}
},
data: {
myBehaviorData: {}
},
attached: function(){},
methods: {
myBehaviorMethod: function(){}
}
})