有时候一些特定标签的子标签,用自定义的组件无法识别,必须通过is标签来解决这样的问题 举例如tbody标签下面必须用tr标签,指定自定义的组件row为tr就可以解决这样的问题:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>vue中的条件渲染</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>