Skip to content

Latest commit

 

History

History
40 lines (38 loc) · 685 Bytes

template_base.md

File metadata and controls

40 lines (38 loc) · 685 Bytes

TEMPLATE BASE

例子

  • 参考代码:code
  • 实现功能
自定义模板并且使用

Template的声明与使用

  • 声明
Vue.component('row',{
	data: function(){
		return {
			content: 'Hi, I am Leon'
		}
	},
	template: '<tr><td>{{content}}</td></tr>'
})
  • 使用
方法1:
<row></row>
方法2:
<td is='row'></td>

Template的小bug

  • 生成问题
如果使用<row></row>会出现的问题,html会渲染成
<tr>
	<td>Hi I am Leon</td>
</tr>
<table>
	<tbody></tbody>
</table>

ps: 所以建议使用这种方法