JavaScript Framework fairy support js
Single component initial processing

Initial processing

Let's change src/js/components/sample/controller.js to the following.

src/js/components/sample/controller.js
export class Sample {

    constructor() {
    }

    init(data) {
        console.log("init");
        console.log(data);
    }

    sample_input(event) {
        
        for (const item of this.list.values()) {
            item.textContent = event.target.value;
        }
        
    }

}

view.html and controller.js are not yet binded in the constructor
When view.html and controller.js are binded together, the framework calls the init method. The argument of the init method is an object that can be used with the variable name v in view.html.


Next page Unique component

table of contents