Answer the question
In order to leave comments, you need to log in
Vue template in mixin?
Colleagues, good afternoon.
Can you mix a template?
The idea is the following.
progress_dialogs.js
export const progress_dialogs = {
data() {
return {
progress_dialog_message: "",
progress_dialog_visible: false,
}
},
methods: {
showProgressDialog(message) {
this.progress_dialog_message = message
this.progress_dialog_visible = true
},
hideProgressDialog() {
this.progress_dialog_message = ""
this.progress_dialog_visible = false
},
}
}
...
// в некоторых шаблонах мне приходится дублировать вот это
<progress-dialog
:message="progress_dialog_message"
:visible="progress_dialog_visible"
/>
...
import {progress_dialogs} from "../../mixins/progress_dialogs"
export const progress_dialogs = {
template: `
<progress-dialog
:message="progress_dialog_message"
:visible="progress_dialog_visible"
/>
`
...
}
Answer the question
In order to leave comments, you need to log in
Why not just make this part of the template a separate component and reuse it?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question