<!DOCTYPE html>
<html>
<head>
<title>change color</title>
<script src="./vue.js"></script>
</head>
<body>
<div id='app'>
<table>
<tbody>
<tr is="row"></tr>
<tr is="row"></tr>
<tr is="row"></tr>
</tbody>
</table>
</div>
<script>
Vue.component('row',{
template:'<tr><td>this is a row</td></tr>'
})
var vm=new Vue({
el:'#app',
})
</script>
</body>
</html>
当需要用组件替代表格中的 tr 时会出现错误,因为规定了 tbody 中必须有 tr。
所以在这里需要使用is ,让 tr 为 自定义的组件。
同理,ul 里 的 li 也需要使用is来使用自己定义的组件