美文网首页
vue :is和is 案例

vue :is和is 案例

作者: newway_001 | 来源:发表于2019-07-25 14:36 被阅读0次
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
</head>

<body>
    <div id="app"> <span>这是 :is="show"的案例</span>
        <component :is="show"></component> <span>这是 is="show"的案例</span>
        <component is="show"></component>
    </div>
    <script>
        Vue.component('one', {
            template: "<div>one</div>"
        }) 
        Vue.component('show', {
            template: "<div>show</div>"
        }) 
        var vm = new Vue({
            el: '#app',
            data: {
                show: 'one'
            },
        })
    </script>

</body>

</html>

相关文章

网友评论

      本文标题:vue :is和is 案例

      本文链接:https://www.haomeiwen.com/subject/nrdhrctx.html