Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

vue A - B -C组件中插槽传值问题

c中有读取插槽信息。
怎么让a传递插槽到B b在传递给c
b组件是template写的,没用render, 怎么用template能把定义的插槽直接传递给c且能获取内容的,
插槽名称自定义的,不是写死的。
c中用的是$scopedSlots渲染的

..a
<template>
    <div>
       <b>
         <template #name="scope">
           <span>{{scope.xxx}} </span>
         </template>
       </b>
    </div>
</template>

...
data() {
    return {
      list: [{
         name: 'admin'
      }]
    }
}
// b文件 非renader怎么把a的传递到c,
<template>
    <div>
       <c>
       </c>
    </div>
</template>
// c文件 不改此文件代码
render() {
  // $scopedSlots遍历渲染
  return <>
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...