UserSocial.vue
1.3 KB
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
51
52
53
54
<script setup lang="ts">
import { ElTable, ElTableColumn } from 'element-plus'
import { onMounted, reactive } from 'vue'
interface sociaType {
title: string
type: string
source: string
img: string
}
interface socialUserType {
socialUser: {
socia: sociaType[]
}
}
const state = reactive<socialUserType>({
socialUser: {
socia: []
}
})
const initSocial = () => {
console.info(1)
}
const bind = () => {
console.info(1)
}
const unbind = () => {
console.info(1)
}
onMounted(async () => {
await initSocial()
})
</script>
<template>
<el-table :data="state.socialUser.socia" :show-header="false">
<el-table-column label="社交平台" align="left" width="120" prop="socia">
<template #socia="{ row }">
<img style="height: 20px; vertical-align: middle" :src="row.img" alt="" />
{{ row.title }}
</template>
</el-table-column>
<el-table-column label="操作" align="left" prop="action">
<template #action="{ row }">
<div v-if="row.openid">
已绑定
<el-button link type="primary" @click="unbind()">(解绑)</el-button>
</div>
<div v-else>
未绑定
<el-button link type="primary" @click="bind()">(绑定)</el-button>
</div>
</template>
</el-table-column>
</el-table>
</template>