首页 > 解决方案 > 如何在 vue 内联模板中使用嵌套组件变量?

问题描述

我在使用 Laravel 后端填充的刀片模板中有类似的内容:

<component-1 inline-template>
    <child-component-1 v-show='comps.cc1'></child-component-1>
    <child-component-2>
        <grandchild-component-1 v-show='subComps.cc1></grandchild-component-1>
        <grandchild-component-2 v-show='subComps.cc2></grandchild-component-2>
    </child-component-2>
</component-1>

comps对象正在引用来自component-1的变量,这没关系,但subComps对象也试图从component-1引用变量,我希望它引用来自child-component-2的变量。

我怎样才能做到这一点?

提前致谢。

标签: laravelvuejs2vue-componentlaravel-blade

解决方案


推荐阅读