使用is属性解决bug 页面
Vue根实例中除外
在子组件定义data时,data必须是个函数,
<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Vue中的列表渲染</title><!--引入vue.js库--><script src="../vue.js"></script>
</head><body>
<div id="root"><table><ul><tr is="row"></tr><tr is="row"></tr><tr is="row"></tr></ul></table>
</div><script>Vue.component('row', {data: function () {return {content: 'this is row'}},template: '<tr><td>{{content}}</td></tr>'})/*创建了一个vue实例*/var vm = new Vue({el: '#root',});
</script>
</body>
</html>
通过ref获取dom节点