We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用特殊的 元素作为原始内容的插槽。
<div> <h2>我是子组件的标题</h2> <slot> 我是默认内容 </slot> <!--name为对应标志位--> <slot name="head"> 我是默认head内容 </slot> </div>
<!-- 键值对中间没有内容,则slot显示为 “我是默认内容。 ”--> <keyboard :total.sync="vinInput" v-on:sure="getCarInfo"></keyboard> <!-- 键值对中间有内容,则slot显示为 “<div>123321</div><div>222222222222</div> ”--> <keyboard :total.sync="vinInput" v-on:sure="getCarInfo"> <div>123321</div> <div slot="head">222222222222</div> </keyboard>
子组件
<div> <h3>这里是子组件</h3> <slot :data="data2"></slot> </div> <script> data() { return { data2: ['zhangsan', 'lisi', 'wanwu', 'zhaoliu', 'tianqi', 'xiaoba'] }, </script>
父组件处
<keyboard :total.sync="vinInput" v-on:sure="getCarInfo"> <!-- 使用处只需添加 slot-scope="props"--> <template slot-scope="user"> <div class="tmpl3"> <!-- <span>{{user}}</span> --> <span v-for="item in user.data">{{item}}</span> </div> </template> </keyboard>
<template slot="up" slot-scope="{}">
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Slot插槽
使用特殊的 元素作为原始内容的插槽。
Slot的使用
作用域插槽slot-scope的使用
template循环引用报错以及解决办法
The text was updated successfully, but these errors were encountered: