I am looking to combine the functions of each different switches into one button so all lights are on when i click it, however, only two functions were executed when i clicked the button.
<div><button v-on:click="onLightar(); onLightmngr(); onLightfy(); onLightmr(); onLightT(); onLightbr();" >Switch on all groundfloor lights </button></div>
To make it simple and easy to understand, You can just call a single method on click and then invoke all the switches methods from that method.
In Template :
<div>
<button v-on:click="switchOnAllLights">Switch on all groundfloor lights </button>
</div>
In Script :
switchOnAllLights() {
this.onLightar();
this.onLightmngr();
this.onLightfy();
this.onLightmr();
this.onLightT();
this.onLightbr();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.