index.js
940 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var main = new Vue({
el:"#main",
data:function(){
return{
// 公共数据
allData:__data,
// 左侧tab栏active
leftKey:'course',
// 右侧部分需要的数据
nowData: {},
}
},
// 计算属性
computed: {
videoList: function () {
return this.nowData.videoList || []
}
},
// 钩子函数
mounted() {
this.nowData = __data[this.leftKey]
console.log("右侧数据",this.nowData)
},
// 监控属性
watch: {
// 监听导航按钮下标改变,使用导航对应的平台数据
leftKey: function (newVal, oldVal) {
this.nowData = __data[newVal]
},
},
methods: {
changeTabIndex: function (key) {
console.log(this.leftKey)
console.log(Key)
this.leftKey = key;
}
},
})