# Custom attribute v2.5.0+
Some extensions to business logic processing generation rules can be achieved through custom attributes
# Tutorials
- Define a custom attribute extension
const optionEffect = {
//The name of the custom attribute
name: 'option',
//Attribute bound components, not set or'*' defaults to all components
components: '*',
//rule initialization
init({value}, rule, fapi) {
},
//rule loaded
loaded({value}, rule, fapi) {
},
//Attribute value changed
watch({value}, rule, fapi) {
},
//The value of the component changes
value({value}, rule, fapi) {
},
//control takes effect
control({value}, rule, fapi) {
},
//rule remove
deleted({value}, rule, fapi) {
},
//rule mounted
mounted({value}, rule, fapi) {
}
}
- Mount custom attribute extension
formCreate.register(optionEffect)
- Use custom attributes in rules
{
type:'...',
effect:{
//option is a custom attribute name
option:'any'
}
//...
}