# Custom attribute v2.5.0+

Some extensions to business logic processing generation rules can be achieved through custom attributes

# Tutorials

  1. 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) {
    }
}

  1. Mount custom attribute extension
formCreate.register(optionEffect)
  1. Use custom attributes in rules
{
    type:'...',
    effect:{
        //option is a custom attribute name
        option:'any'
    }
    //...
}

# Example

# Automatically set the component's options

# Monitoring component value changes

# Monitor custom attribute changes