Answer the question
In order to leave comments, you need to log in
How to render a vue component on an event?
Hey!
I can't figure out how to do the following. There is a vue-component, like this one:
Vue.component('project-status', {
props: ['status'], //{status: Boolean}, // Входные параметры vue-компонента
template: `
<div class="row">
<div class="col-6">Status:</div>
<div class="col-6">
<span class="badge"
v-bind:class="{ 'badge-success': status, 'badge-danger': status == false }"
v-text="status ? 'Enabled' : 'Disabled'">
</span>
</div>
</div>
`
});
var vue_project = new Vue({
data: {
window_title: '',
project: {
id: null,
dt_from: null,
name: '',
description: '',
is_enabled: false,
},
},
....
this.$emit('project-saved');
....
});
<project-status status="project.is_enabled"></project-status>
<project-status v-bind:status="project.is_enabled"></project-status>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question