I'm developing a Vue webpage for displaying GitLab pipelines. I have a main Vue component (i.e. "Monitor.vue") and X child components that display the pipelines schedules for each of the X projects on my GitLab instance (called "Schedules.vue").
In "Monitor" I'd like to have a checkbox that would make the schedules' container disappear for the projects where no pipeline was scheduled yet. This is what I wrote for doing so:
Monitor.vue:
<template>
<input type="checkbox" value="false" v-model="checked">
Show only projects that have scheduled pipelines
<div v-if="checked">Checkbox checked!</div>
<div class="row">
<div v-for="project in projects" :key="project.id">
<Schedules :checkBoxChecked="checked"></Schedules>
</div>
</div>
</template>
<script>
import Schedules from "./Schedules.vue";
export default {
components: {
Schedules
},
data() {
return {
checked: false
};
}
};
<script>
Schedules.vue:
<template>
<div v-if="checkBoxChecked">
No scheduled pipelines yet.
</div>
<div v-else>
<!-- Display pipelines here -->
</div>
</template>
<script>
export default {
name: "Schedules",
props: "checkBoxChecked"
};
</script>
Now, the value of checked
indeed changes in Monitor when I check the box but when I try to pass it to the child components, the value of checkBoxChecked in undefined in the web console.
What did I forget here?
Aucun commentaire:
Enregistrer un commentaire