<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
<script type="text/javascript" src="../js/vue.js"></script>
<!-- Latest compiled and minified CSS & JS -->
<!--<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>-->
<link rel="stylesheet" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div id="hdcms">
<div :is="formType"></div>
<input type="radio" v-model="formType" value="hdInput" >文本框
<input type="radio" v-model="formType" value="hdTextarea">文本域
</div>
<script type="text/x-template" id="hdInput">
<div><input type="text"></div>
</script>
<script type="text/x-template" id="hdTextarea">
<div><textarea name="" id="" cols="30" rows="10"></textarea></div>
</script>
<script>
var hdInput = {
template: "#hdInput",
};
var hdTextarea = {
template: "#hdTextarea",
};
new Vue({
el: '#hdcms',
components: {hdInput,hdTextarea},
data: {
formType:'hdInput'
}
});
</script>
</body>
</html>
效果: