Please see this example:
HelloWorld.vue
<template>
<button @click="click">Click</button>
</template>
<script>
export default {
methods: {
click() {
this.$emit("click");
}
}
};
</script>
index.vue
<template>
<div>
<HelloWorld @click="true && click" />
</div>
</template>
<script>
import HelloWorld from "./components/HelloWorld";
export default {
components: {
HelloWorld
},
methods: {
click() {
window.alert("123");
}
}
};
</script>
This won't trigger anything, why?
Why @click="true && click" can't do the trick?
What's under the hood? How Vue evaluate things like this?