对应文档节点: https://vuefe.cn/v2/guide/render-function.html#Slots

<body>
<div id="app">
<div class="parent">
<anchored-heading>
</anchored-heading>
</div>
</div>
</body> <script>
Vue.component('child', {
render: function (createElement) {
// <div><slot :text="msg"></slot></div>
//debugger;
return createElement('div', [
this.$scopedSlots.default({
text: this.msg
})
])
},
// template: `
// <div class="child">
// <slot :text="msg"></slot>
// </div>
// `,
data: function () {
return {
msg: "Demo"
}
} }); Vue.component('anchored-heading', {
render(createElement) {
return createElement('div', [
createElement('child', {
// pass scopedSlots in the data object
// in the form of { name: props => VNode | Array<VNode> }
scopedSlots: {
default: function (props) {
debugger;
return createElement('span','hello-'+ props.text)
}
}
})
])
},
// template: `
// <div class="parent">
// <child>
// <template scope="props">
// <span>hello {{ props.text }}</span>
// </template>
// </child>
// </div>
// `
}) new Vue({
el: "#app"
});
</script>

最新文章

  1. oracle--trunc与to_char的区别
  2. hdu 4763 kmp ***
  3. 通过ReentrantLock源代码分析AbstractQueuedSynchronizer独占模式
  4. js的数组操作 splice
  5. Web Uploader文件上传&amp;&amp;使用webupload有感(黄色部分)
  6. Django 1.6 最佳实践: 如何设置django项目的设置(settings.py)和部署文件(requirements.txt)
  7. System.Rtti.TRttiObject.GetAttributes 简例
  8. GB2312 Unicode转换表实现跨平台utf8转码unicode
  9. PullToRefreshListView调用onRefreshComplete方法 无法取消刷新的bug
  10. 下载doxygen
  11. zoj2977Strange Billboard (国家压缩+罗列)
  12. Oracle数据库中的重要对象
  13. php 下载文件
  14. -bash: /etc/profile: line 11: syntax error near unexpected token `$&#39;{\r&#39;&#39;报错问题解决
  15. mysql+redis+memcached
  16. Springboot Download file
  17. SparkSQL和DataFrame
  18. ajax参考增删改查
  19. mysql 表格操作指令大全(Show、desc、create、insert into、delete、select、drop、update、alter)
  20. 命令行参数解析函数getopt和getopt_long函数【转】

热门文章

  1. WPF WebBrowser+TabControl MVVM模式 简单应用 提供源码下载
  2. [ActionScript 3.0] 运用Color类interpolateColor静态方法绘制渐变色
  3. [独家] Adobe Flash 直接复制元件不改变原元件
  4. 4 个快速的 Python 编译器 for 2018
  5. redis存储的数据类型
  6. (USB HID) Report Descriptor 理解
  7. python学习,day3:示例,进度条
  8. mybatis的CRUD实例(三)
  9. Codeforces - tag::dp 大合集 [占坑 6 / inf]
  10. mongodb与python随手记