【发布时间】:2022-02-06 17:40:05
【问题描述】:
我有两个简单的 vue 组件,想在另一个的默认插槽中使用一个。由于某种原因,它只需要第一个元素,但之后不显示任何内容。如果我把标准放在第一个元素之前,它会正常显示,但如果我放在 if 之后,它也不会显示。
页面:
<div id="app">
<v-app>
<v-main>
<gantt-chart>
<div> this is visible </div>
<gantt-row key="1" title="test 1"/>
<div> nothing of this and beyond is shown</div>
<gantt-row key="2" title="test 2"/>
<gantt-row key="3" title="test 3"/>
</gantt-chart>
</v-main>
</v-app>
</div>
<script type="text/javascript">
Vue.component("gantt-chart", httpVueLoader('/plugin_assets/javascripts/components/GanttChart.vue'));
Vue.component("gantt-row", httpVueLoader('/plugin_assets/javascripts/components/GanttRow.vue'));
var app = new Vue({
el: '#app',
})
</script>
甘特图.vue:
<template>
<div>
<slot />
</div>
</template>
<script>
module.exports = {
props: [],
name:"GanttChart",
data() {
return {};
},
computed: {},
methods: {},
};
</script>
<style scoped></style>
甘特行.vue:
<template>
<div>
{{ title }}
</div>
</template>
<script>
module.exports = {
props: ["title"],
name:"GanttRow",
data() {
return {};
},
computed: {},
methods: {},
};
</script>
<style scoped></style>
【问题讨论】:
标签: javascript html vue.js vuejs2 http-vue-loader