第1种写法

test.vue

<template functional>
<div class="test">
{{props.test.name}}
</div>
</template> <script>
export default {
props: {
test: Object,
default: () => ({})
}
}
</script>

父组件 index.vue

<template>
<div>
<test :test="{name: 'vue'}"></test>
</div>
</template>
<script>
import test from './test'
export default {
components: {
test
}
</script>

第2种写法

test.js

import Vue from 'vue'

Vue.component('test', {
functional: true,
props: {
test: {
type: Object,
required: true
}
},
render: function (createElement, context) {
return createElement(
'div',
{
attrs: {
class: 'test'
}
},
[context.props.test.name]
)
}
})

父组件 index.vue

<template>
<div>
<test :test="{name: 'vue'}"></test>
</div>
</template>
<script>
import './test.js'
</script>

最新文章

  1. 一个技术汪的开源梦 —— 基于 .Net Core 的组件 Nuget 包制作 &amp; 发布
  2. 50. 树的子结构[subtree structure in tree]
  3. JSP内置对象及常用方法
  4. Notepad++的xml文本格式化
  5. 锋利的js之妈妈再也不用担心我找错钱了
  6. HDU 1016 Prime Ring Problem(经典DFS+回溯)
  7. Linux是怎么启动的
  8. 对DTU系统结构的重新思考
  9. 基于visual Studio2013解决C语言竞赛题之1068指针数组
  10. C#中的Virtual、Override和new关键词理解
  11. 修复 Ubuntu 14.04 的系统设置残缺问题
  12. hadoop中setup,cleanup,run和context讲解
  13. Pytorch入门实例:mnist分类训练
  14. struts2框架之文件下载(参考第三天学习笔记)
  15. docker自动重启容器
  16. java JDK安装教程
  17. Row_number 详解
  18. bzoj3839【Pa2013】Działka
  19. openerp在ubuntu中查看日志
  20. 《从零开始学Swift》学习笔记(Day54)——抛出错误

热门文章

  1. Docker - 解决同步容器与主机时间报错:Error response from daemon: Error processing tar file(exit status 1): invalid symlink &quot;/usr/share/zoneinfo/UTC&quot; -&gt; &quot;../usr/share/zoneinfo/Asia/Shanghai&quot;
  2. nginx&amp;http 第三章 ngx http ngx_http_process_request_headers
  3. orphan sockets
  4. leetcode Reverse Nodes in k-Group翻转链表K个一组
  5. 基于FFmpeg的Dxva2硬解码及Direct3D显示(四)
  6. MyBatis 使用手册
  7. Stream流的这些操作,你得知道,对你工作有很大帮助
  8. 实在是秒啊,我还从来没见过把Spring之AOP讲的这么通俗易懂的,安排!
  9. 用过MindManager后才知道思维导图原来这么简单
  10. 详解CorelDRAW中刻刀工具的具体运用