<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<!-- <link rel="stylesheet" type="text/css" href="../../css/reset.css"> -->
<script type="text/javascript" src="../vue/vue.min.js"></script>
<script type="text/javascript" src="../vue/babel.min.js"></script>
</head>
<body style="padding:30px">
<div id="app">
<component v-bind:is="tabShow"></component>
<button @click="tab('A')">tab1</button>
<!-- <button v-on:click="tab('A')">tab1</button> -->
<button @click="tab('B')">tab2</button>
<button @click="tab('C')">tab3</button>
<button @click="tab('D')">tab4</button>
</div>
</body>
</html>
<script>
A = {
template:`<h1>我是第一一一个tab</h1>`
}
B = {
template:`<h1>我是第二二二个tab</h1>`
}
C = {
template:`<h1>我是第三三三个tab</h1>`
}
D = {
template:`<h1>我是第四四四个tab</h1>`
}
new Vue({
el:'#app',
data(){
return {
tabShow:'A'
}
},
components:{
'A': A,
'B': B,
'C': C,
'D': D
},
methods:{
tab(currentShowTab){
this.tabShow = currentShowTab;
}
}
})
</script>
vue tab选项卡
最新推荐文章于 2024-04-11 11:03:20 发布