Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

javascript - VueJS结合了v-on点击功能(VueJS combine v-on click functionality)

I was trying to combine functionality upon clicking the button in VueJS.(我试图在单击VueJS中的按钮时合并功能。)

Is it possible to run both in one click function?(一键运行是否可以同时运行?) see below the two codes:(参见下面的两个代码:) v-on click triggers function:(v-on点击触发功能:) <button class="btn" type="button" @click="doingsomething">Btn1</button> v-on click assign a value:(右键单击分配一个值:) <button class="btn" type="button" @click="activeBtn = 'btn1'" :class="{active: activeBtn === 'btn1' }">Btn1</button>   ask by Kevin translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

尝试这个;

<button class="btn" type="button" @click="doingsomething();activeBtn='btn1'" :class="{active: activeBtn === 'btn1' }">Btn1</button> 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...