0
有什麼辦法可以有多個v-on:點擊同一項目上的事件? 我試圖同時顯示/隱藏切換導航,並對切換導航的項目執行css動畫。Vue.js多個v-on:點擊事件
<template>
<div>
<nav v-if="seen">
<ul>
<li><a href="#front" v-smooth-scroll>forside</a></li>
<li><a href="#services" v-smooth-scroll>ydelser</a></li>
<li><a href="#cases" v-smooth-scroll>cases</a></li>
<li><a href="#contact" v-smooth-scroll>kontakt</a></li>
</ul>
</nav>
<div @click="seen = !seen" @click="setActive" id="burger-container">
<div id="burger">
<span> </span>
<span> </span>
<span> </span>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
seen: false
}
},
methods: {
setActive (event) {
event.target.classList.toggle('open')
}
}
}
</script>
的可能的複製[如何調用多個功能與V系列:點擊](HTTPS:/ /stackoverflow.com/questions/38744932/how-to-call-multiple-function-with-v-onclick) –