This is great! One question, how would you pass in multiple parameters? Would it look something like this?
updateChecked({event, param2, param3}) { console.log(event, param2, param3); console.log((this.checked = event.target.checked)); } render() { return html` <label class="md_switch"> <input @change="${e => this.updateChecked({ event: e, param2: this.param2, param3: this.param3 })}" ?checked="${this.checked}" ?disabled="${this.disabled}" type="checkbox" /> <span class="md_switch__toggle"></span> <slot></slot> </label> `; }
I don't think you'd ever want to add more parameters with an event. Looking at your example the params were attached to this anyway so we can just get them with the function.
this
updateChecked(e) { console.log(e, this.param2, this.param3); } render() { return html` <label class="md_switch"> <input @change="${this.updateChecked}" ?checked="${this.checked}" ?disabled="${this.disabled}" type="checkbox" /> <span class="md_switch__toggle"></span> <slot></slot> </label> `; }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This is great! One question, how would you pass in multiple parameters? Would it look something like this?
I don't think you'd ever want to add more parameters with an event. Looking at your example the params were attached to
this
anyway so we can just get them with the function.