在 .vue 组件中嵌套内联模板

Nest an inline template inside of a .vue component

我有一个内联模板,我已经在 Laravel 的 Blade @include('my_inline_template') 中使用过,效果很好。

现在,我已经引入了另一个由其他人开发并使用.vue 文件格式的vue 组件。我想将我的内联模板放在那个 .vue 文件中。

我想做的是像下面这样的东西,它不起作用,因为你不能在 .vue 文件中使用 @include。我有点不知道还能尝试什么,或者这是否可能:

主-vue.js

import Component from './components/Component.vue'
require('./components/my_inline_template');
const vm = new Vue({
    el: '#vue_root',

    components: {
        Component
    }
});

my_inline_template.js

Vue.component('my_inline_template', {
    // blah
});

my_inline_template.blade.php

<my_inline_template inline-template>
   // blah
</my_inline_template

Component.vue

<template>
    <div>
         @include('my_inline_template')
         // More HTML 
    </div>
</template>

<script>

    export default{
        props: ['blah'],

        data() {
            return{
                // blah
                },
        },

        mounted() {
            // blah
        },

        methods: {
            // blah
        }
    }
</script>

如何在上面的 .vue 文件中包含 my_inline_template?谢谢!

我能够通过将组件分成几个较小的组件来解决这个问题。这样,我可以在同一个 blade 视图中将 .vue 组件和内联模板放在一起。但是,这并不是我问题的真正答案,所以如果有人愿意提供答案,我仍然会很感激。

我猜你不能在 .vue 文件中嵌套使用 blade 的内联模板。