# 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({val}, rule, fapi) {
    },
    //rule loaded
    loaded({val}, rule, fapi) {
    },
    //Attribute value changed
    watch({val}, rule, fapi) {
    },
    //The value of the component changes
    value({val}, rule, fapi) {
    },
    //control takes effect
    control({val}, rule, fapi) {
    },
    //rule remove
    deleted({val}, rule, fapi) {
    },
    //rule mounted
    mounted({val}, 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