someFunction(el) {
console.log(this.str)
}
someFunction(this.str)
<template>
<button
type="button"
@click="formatDoc('bold')"
:style="styles.fontBold ? 'font-weight': 'bold' : 'font-weight: 'regular'"
:class="{ 'button--active': styles.fontBold }"
>
<v-icon>mdi-format-bold</v-icon>
</button>
</template>
<script>
export default {
data() {
return {
styles: {
fontBold: false,
}
}
},
methods: {
formatDoc(cmd, value = null) {
if (value) {
document.execCommand(cmd, false, value);
} else {
document.execCommand(cmd);
switch(cmd) {
case 'bold':
this.styles.fontBold = !this.styles.fontBold;
break;
}
}
}
}
}
</script>
<template>
<div class="home">
<img
alt="Vue logo"
src="../assets/logo.png"
>
<Modal
v-if="modalOpen"
>
<div
v-html="someData"
></div>
</Modal>
<button
@click="modalIsOpen = !modalIsOpen"
>
Переключатель модалки
</button>
</div>
</template>
<script>
import Modal from '@/components/Modal.vue'
import { ref } from 'vue';
export default {
name: 'Home',
components: {
Modal,
},
setup() {
const modalIsOpen = ref(true);
const someData = 'some data...';
return { modalIsOpen, someData };
},
}
</script>