html
<div id="app"> <component :is="cut"></component> <button @click="current">点击切换</button> </div>
js
var classA = { template:`<div>状态1</div>` }; var classB = { template:`<div>状态2</div>` }; var classC = { template:`<div>状态3</div>` } var vm = new Vue({ el:"#app", data:{ cut:classA }, methods:{ current:function(){ if(this.cut==classA){ this.cut=classB }else if(this.cut==classB){ this.cut=classC }else{ this.cut=classA } } } })