vue 选项卡
来源:互联网 发布:ipad加入网络密码错误 编辑:程序博客网 时间:2024/05/18 20:13
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<!-- <script src="js/jquery-1.7.2.min.js"></script> -->
<script src="js/vue.js"></script>
<style type="">
.on{
background: #ccc
}
.display{
display:block;
}
</style>
<script type="text/javascript">
window.onload=function(){
Vue.component('change',{
template:"#change",
props:{
name:Array,
Data:Array
},
data:function(){
return{
onname:''
}
},
computed:{
on:function(item){
console.log(item)
}
},
methods:{
toggle:function(item,index){
// console.log(item.name)
this.onname = item.name
item.show = !item.show
console.log(this.onname)
}
},
})
var dome=new Vue({
el:".main",
data:{
changeData:[
{ name: '第一', con: "第一内容" ,show:true },
{ name: '第二', con: "第二内容" ,show:false }
]
}
})
}
</script>
<script type="text/x-template" id="change">
<div >
<ul>
<li
v-for="top in Data"
@click="toggle(top,$index)"
:class="{'on':onname == top.name}"
>
{{top.name}}
</li>
</ul>
<div v-for="top in Data" v-if="top.name==onname">
{{top.con}}
</div>
</div>
</script>
</head>
<body>
<div class="main" >
<change
:data="changeData"
>
</change>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<!-- <script src="js/jquery-1.7.2.min.js"></script> -->
<script src="js/vue.js"></script>
<style type="">
.on{
background: #ccc
}
.display{
display:block;
}
</style>
<script type="text/javascript">
window.onload=function(){
Vue.component('change',{
template:"#change",
props:{
name:Array,
Data:Array
},
data:function(){
return{
onname:''
}
},
computed:{
on:function(item){
console.log(item)
}
},
methods:{
toggle:function(item,index){
// console.log(item.name)
this.onname = item.name
item.show = !item.show
console.log(this.onname)
}
},
})
var dome=new Vue({
el:".main",
data:{
changeData:[
{ name: '第一', con: "第一内容" ,show:true },
{ name: '第二', con: "第二内容" ,show:false }
]
}
})
}
</script>
<script type="text/x-template" id="change">
<div >
<ul>
<li
v-for="top in Data"
@click="toggle(top,$index)"
:class="{'on':onname == top.name}"
>
{{top.name}}
</li>
</ul>
<div v-for="top in Data" v-if="top.name==onname">
{{top.con}}
</div>
</div>
</script>
</head>
<body>
<div class="main" >
<change
:data="changeData"
>
</change>
</div>
</body>
</html>
0 0
- vue 选项卡
- vue 选项卡 感想
- vue选项卡切换
- vue 插件tab选项卡
- vue.js--Tab选项卡
- vue.js--Tab选项卡
- vue.js--Tab选项卡
- Vue入门(一)-Vue实现选项卡效果
- vue 动态加载tab选项卡组件
- Vue组件选项props
- vue中用动态组件实现选项卡切换效果
- 使用vue.js简单的tab选项卡效果
- vue中使用v-bind:class的选项卡
- VUE 获取数据 并进行增删改 混合了选项卡
- 使用Webpack创建vue的tab选项
- Vue Component 父子组件及组件选项
- Vue.js组件的重要选项
- vue.js组件的重要选项
- HDU 4372:Count the Buildings (Stirling数)
- php原始代码实现无刷新删除
- 搭建Eclipse+ADT+Android SDK 安卓开发环境
- TCP连接的部分细节及边界情况分析
- 触摸左右滑动发生事件
- vue 选项卡
- C++二叉树的前序、中序、后序遍历及实现
- Leetcode 221. Maximal Square (Medium) (cpp)
- LeetCode笔记:172. Factorial Trailing Zeroes
- Es tut noch weh 双语歌词
- iOS被开发者遗忘在角落的NSException-其实它很强大
- 安卓实现复读功能
- Linux发行版Red-Hat下相关命令
- java执行linux命令