<!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>
网友评论