<a @click="isActive = !isActive">Ссылка</a>
<div :class="{active: isActive}"></div>
data() {
isActive : false
}
data: () => ({
active: false,
}),
created() {
const onClick = e => this.active = this.$refs.block.contains(e.target) && this.active;
document.addEventListener('click', onClick);
this.$on('hook:beforeDestroy', () => document.removeEventListener('click', onClick));
},
<button @click.stop="active = !active">click me</button>
<div :class="{ active }" ref="block">hello, world!!</div>