mytrain.vue
988 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
<template>
<uni-segmented-control :current="current" styleType="text" :values="items"
activeColor="#AD181F" @clickItem="onClickItem" ></uni-segmented-control>
<view>
<view class="nodata" v-if="list.length == 0">
<image mode="aspectFit" src="/static/nodata.png"></image>
<text>暂无数据</text>
</view>
</view>
</template>
<script setup>
import * as my from '@/myCenter/center_api.js';
import { ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
const app = getApp();
const items = ref([
'培训', '订单'
])
const current = ref(0)
const list = ref([])
onShow(() => {
if (app.globalData.isLogin) {
init();
} else {
app.firstLoadCallback = () => {
init();
};
}
});
function init(){
my.getMyTrain().then(res=>{
list.value = res.rows
})
}
function onClickItem(e){
console.log(e)
if(e.currentIndex==1){
uni.navigateTo({
url: `/myCenter/mytrain/myBill`
});
}
}
</script>
<style>
</style>