ButtonSync.vue
1.31 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
55
56
57
58
59
60
61
62
<script>
export default {
name: 'ButtonSync',
props: {
customeBtn: {
type: Boolean,
default: false,
},
lastSyncTime: {
type: [String, Number],
default: 0,
},
},
components: {},
data() {
return {}
},
computed: {
disabled() {
// return this.lastSyncTime ? (+new Date() - +new Date(this.lastSyncTime)) / 3600000 < 2 : false
return false
},
},
watch: {},
created() {},
mounted() {},
methods: {
sync() {
// if (this.disabled) {
// this.msgError('由于企业微信开放平台的限制,两小时内不得重复同步操作')
// return
// }
this.$emit('click')
},
},
}
</script>
<template>
<div class="button-sync">
<el-tooltip
v-if="disabled"
effect="light"
class="item"
content="由于企业微信开放平台的限制,两小时内不得重复同步操作"
placement="top-start">
<el-tag type="info" size="default"><slot></slot></el-tag>
</el-tooltip>
<div v-else v-preventReClick class="cp" @click="sync">
<slot v-if="$slots.button" name="button"></slot>
<el-button v-else type="primary">
<slot></slot>
</el-button>
</div>
</div>
</template>
<style lang="scss" scoped>
.button-sync {
display: inline-block;
}
</style>