Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js Vue 2.6.0-如何使用新的插槽语法将插槽内容呈现给子组件';s命名槽_Vue.js - Fatal编程技术网

Vue.js Vue 2.6.0-如何使用新的插槽语法将插槽内容呈现给子组件';s命名槽

Vue.js Vue 2.6.0-如何使用新的插槽语法将插槽内容呈现给子组件';s命名槽,vue.js,Vue.js,要理解我的问题,请查看以下伪代码: <my-tooltip-wrapper> <some-slot-content /> </my-tooltip-wrapper 但是,如何将其更改为新语法?我试过这个,但没用: <template #reference> <slot name="reference" /> </template> 你好,世界 Vue.组件(“插槽所有者”{ 模板:` ` }); 有人

要理解我的问题,请查看以下伪代码:

<my-tooltip-wrapper>
  <some-slot-content />
</my-tooltip-wrapper
但是,如何将其更改为新语法?我试过这个,但没用:

<template #reference>
  <slot
    name="reference"
  />
</template>


你好,世界
Vue.组件(“插槽所有者”{
模板:`
`
});

有人问了一个类似的问题


它是用最新的

修复的,你能用我的小提琴吗,因为你的答案根本没有帮助……元素ui还不支持vue-2.6插槽语法:这很奇怪,因为我认为这在我的情况下无关紧要,因为我不需要在元素中渲染某些东西。我只需要将插槽“重定向”到elements插槽…我看到了您的示例,它正在运行。@roliroli很抱歉误解,此示例使用旧语法,请尝试使用新语法…我认为此错误已通过以下方法修复:
<template #reference>
  <slot
    name="reference"
  />
</template>
<slot-owner>
  <template v-slot:reference>
      Hello world
  </template>
</slot-owner>


Vue.component('slot-owner', {
  template: `
     <div>
        <slot name="reference" />
     </div>
  `
});