Life cycleexperiment

WARNING

Currently, the complete life cycle has not been fully implemented. It is an experimental function.

Open #[before_mount], #mounted, #[before_update], #[updated]

#[before_mount]

Called immediately after the component instance is initialized. Use the #[before_mount] annotation on a method or closure.

Usage

1impl MyView{
2    #[before_mount]
3    fn before_mount(){
4        println!("before mount!");
5    }
6}

#[mounted]

Options called after instance initialization is complete

Usage

1impl MyView{
2    #[mounted]
3    fn mounted(){
4        println!("mounted!");
5    }
6}

#[before_update]

Called after component properties are updated but before re-rendering the component

Usage

#[updated]

Called after the component properties have been updated and the component has been re-rendered.

Usage

1impl Hello{
2    #[updated]
3    fn do_updated(&mut self){
4        println!("do updated => hello.gen!");
5        let new_val = self.get_count() + 1;
6        self.set_count(new_val);
7    }   
8}