mali-applet-ui 0.1.41 → 0.1.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
</view>
|
|
14
14
|
<view v-if="showConfirmButton || showCancelButton || showFooter" class="ml-drawer-footer">
|
|
15
15
|
<slot name="footer">
|
|
16
|
-
<ml-button v-if="showCancelButton"
|
|
17
|
-
<ml-button v-if="showConfirmButton" status="primary"
|
|
16
|
+
<ml-button v-if="showCancelButton" @click="cancelEvent">{{ cancelButtonText }}</ml-button>
|
|
17
|
+
<ml-button v-if="showConfirmButton" status="primary" @click="confirmEvent">{{ confirmButtonText }}</ml-button>
|
|
18
18
|
</slot>
|
|
19
19
|
</view>
|
|
20
20
|
</view>
|
|
@@ -1,27 +1,74 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-tooltip">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<view>{{ title }}</view>
|
|
2
|
+
<view class="ml-tooltip" :class="[className || '', `placement-${placement || 'bottom'}`]">
|
|
3
|
+
<view class="ml-tooltip-content" @click="toggleVisible">
|
|
4
|
+
<slot></slot>
|
|
6
5
|
</view>
|
|
6
|
+
<ml-tooltip-view v-if="showTip" :title="title" :placement="placement" position="absolute" :top="top" :left="left"></ml-tooltip-view>
|
|
7
7
|
</view>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script>
|
|
11
11
|
export default {
|
|
12
12
|
name: 'MlTooltip',
|
|
13
|
+
options: {
|
|
14
|
+
virtualHost: true
|
|
15
|
+
},
|
|
13
16
|
props: {
|
|
14
17
|
value: Boolean,
|
|
15
18
|
title: String,
|
|
16
|
-
placement: String
|
|
19
|
+
placement: String,
|
|
20
|
+
trigger: String,
|
|
21
|
+
className: String
|
|
17
22
|
},
|
|
18
23
|
data () {
|
|
19
24
|
return {
|
|
25
|
+
showTip: false,
|
|
26
|
+
top: 0,
|
|
27
|
+
left: 0
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
watch: {
|
|
31
|
+
value (value) {
|
|
32
|
+
this.showTip = value
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
created () {
|
|
36
|
+
this.showTip = this.value
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
open () {
|
|
40
|
+
this.top = 0
|
|
41
|
+
this.left = 0
|
|
42
|
+
const value = true
|
|
43
|
+
this.showTip = value
|
|
44
|
+
this.$emit('input', value)
|
|
45
|
+
},
|
|
46
|
+
close () {
|
|
47
|
+
const value = false
|
|
48
|
+
this.showTip = value
|
|
49
|
+
this.$emit('input', value)
|
|
50
|
+
},
|
|
51
|
+
toggleVisible () {
|
|
52
|
+
if (!this.trigger || ['tap', 'click'].includes(this.trigger)) {
|
|
53
|
+
if (this.showTip) {
|
|
54
|
+
this.close()
|
|
55
|
+
} else {
|
|
56
|
+
this.open()
|
|
57
|
+
}
|
|
58
|
+
}
|
|
20
59
|
}
|
|
21
60
|
}
|
|
22
61
|
}
|
|
23
62
|
</script>
|
|
24
63
|
|
|
25
64
|
<style lang="scss">
|
|
26
|
-
|
|
65
|
+
.ml-tooltip {
|
|
66
|
+
position: relative;
|
|
67
|
+
display: inline-block;
|
|
68
|
+
vertical-align: middle;
|
|
69
|
+
.ml-tooltip-content {
|
|
70
|
+
display: inline-block;
|
|
71
|
+
vertical-align: middle;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
27
74
|
</style>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ml-tooltip-view" :class="[className || '', `placement-${placement || 'bottom'}`]" :style="tipStyles">
|
|
3
|
+
<view class="ml-tooltip-warpper">
|
|
4
|
+
<view class="ml-tooltip-title">
|
|
5
|
+
<slow name="title">{{ title }}</slow>
|
|
6
|
+
</view>
|
|
7
|
+
<view class="ml-tooltip-arrows">
|
|
8
|
+
<ml-icon v-if="placement === 'bottom'" name="arrow-up-filling" />
|
|
9
|
+
<ml-icon v-else-if="placement === 'top'" name="arrow-down-filling" />
|
|
10
|
+
<ml-icon v-else-if="placement === 'right'" name="arrow-left-filling" />
|
|
11
|
+
<ml-icon v-else-if="placement === 'left'" name="arrow-right-filling" />
|
|
12
|
+
</view>
|
|
13
|
+
</view>
|
|
14
|
+
</view>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
name: 'MlTooltipView',
|
|
20
|
+
props: {
|
|
21
|
+
title: String,
|
|
22
|
+
position: String,
|
|
23
|
+
top: String,
|
|
24
|
+
left: String,
|
|
25
|
+
bottom: String,
|
|
26
|
+
right: String,
|
|
27
|
+
placement: String,
|
|
28
|
+
className: String
|
|
29
|
+
},
|
|
30
|
+
computed: {
|
|
31
|
+
tipStyles () {
|
|
32
|
+
const posSys = this.position ? `position: ${this.position};` : ''
|
|
33
|
+
const topSys = this.top ? `top: ${this.top};` : ''
|
|
34
|
+
const bottomSys = this.bottom ? `bottom: ${this.bottom};` : ''
|
|
35
|
+
const leftSys = this.left ? `left: ${this.left};` : ''
|
|
36
|
+
const rightSys = this.right ? `right: ${this.right};` : ''
|
|
37
|
+
return `${posSys}${topSys}${bottomSys}${leftSys}${rightSys}`
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<style lang="scss">
|
|
44
|
+
.ml-tooltip-view {
|
|
45
|
+
z-index: 900;
|
|
46
|
+
.ml-tooltip-warpper {
|
|
47
|
+
position: relative;
|
|
48
|
+
display: inline-block;
|
|
49
|
+
color: #FFFFFF;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
padding: $ml-page-interval-margin 24rpx;
|
|
52
|
+
background: rgba(0, 0, 0, 0.85);
|
|
53
|
+
border-radius: $ml-border-radius;
|
|
54
|
+
max-width: 80vw;
|
|
55
|
+
}
|
|
56
|
+
.ml-tooltip-arrows {
|
|
57
|
+
position: absolute;
|
|
58
|
+
color: rgba(0, 0, 0, 0.85);
|
|
59
|
+
font-size: 32rpx;
|
|
60
|
+
}
|
|
61
|
+
&.placement-bottom {
|
|
62
|
+
.ml-tooltip-title {
|
|
63
|
+
top: calc(100% + 20rpx);
|
|
64
|
+
}
|
|
65
|
+
.ml-tooltip-arrows {
|
|
66
|
+
top: -22rpx;
|
|
67
|
+
left: 10rpx;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
&.placement-top {
|
|
71
|
+
.ml-tooltip-title {
|
|
72
|
+
bottom: calc(100% + 20rpx);
|
|
73
|
+
}
|
|
74
|
+
.ml-tooltip-arrows {
|
|
75
|
+
bottom: -22rpx;
|
|
76
|
+
left: 10rpx;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
&.placement-left {
|
|
80
|
+
.ml-tooltip-title {
|
|
81
|
+
top: 0;
|
|
82
|
+
right: calc(100% + 20rpx);
|
|
83
|
+
}
|
|
84
|
+
.ml-tooltip-arrows {
|
|
85
|
+
right: -20rpx;
|
|
86
|
+
top: 10rpx;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
&.placement-right {
|
|
90
|
+
.ml-tooltip-title {
|
|
91
|
+
top: 0;
|
|
92
|
+
left: calc(100% + 20rpx);
|
|
93
|
+
}
|
|
94
|
+
.ml-tooltip-arrows {
|
|
95
|
+
left: -20rpx;
|
|
96
|
+
top: 10rpx;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</style>
|