mali-applet-ui 0.2.97 → 0.2.99

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.
@@ -5,7 +5,11 @@
5
5
  </view>
6
6
  <view v-if="showNotData && !loading" class="ml-load-more-empty">
7
7
  <slot name="empty">
8
- <ml-not-data :emptyUrl="emptyUrl" :emptyText="emptyText" :emptyHint="emptyHint"></ml-not-data>
8
+ <ml-not-data :emptyUrl="emptyUrl" :emptyText="emptyText" :emptyHint="emptyHint">
9
+ <template #content>
10
+ <ml-button>ff</ml-button>
11
+ </template>
12
+ </ml-not-data>
9
13
  <view class="ml-load-more-empty-content">
10
14
  <slot name="emptycontent"></slot>
11
15
  </view>
@@ -66,9 +70,9 @@ export default {
66
70
  return { ...globalStore.loadMore.pageProp, ...this.pageProps }
67
71
  },
68
72
  hasFilters () {
69
- console.log(this.filterForm)
73
+ const fields = this.emptyOpts.fields || []
70
74
  for (let key in this.filterForm) {
71
- if (this.filterForm[key]) {
75
+ if (fields.includes(key) && this.filterForm[key]) {
72
76
  return true
73
77
  }
74
78
  }
@@ -3,7 +3,9 @@
3
3
  <view class="ml-tooltip-content" @click="toggleVisible">
4
4
  <slot></slot>
5
5
  </view>
6
- <ml-tooltip-view v-if="showTip" :title="title" :placement="placement" position="absolute" :width="width" :top="top" :left="left"></ml-tooltip-view>
6
+ <view v-if="showTip" class="ml-tooltip-popup" :style="tipPopupStyles">
7
+ <ml-tooltip-view :title="title" :placement="placement" :width="width" showClose @close="closeEvent"></ml-tooltip-view>
8
+ </view>
7
9
  </view>
8
10
  </template>
9
11
 
@@ -24,8 +26,19 @@ export default {
24
26
  data () {
25
27
  return {
26
28
  showTip: false,
27
- top: 0,
28
- left: 0
29
+ top: '',
30
+ bottom: '',
31
+ left: '',
32
+ right: '',
33
+ }
34
+ },
35
+ computed: {
36
+ tipPopupStyles () {
37
+ const topSys = this.top ? `top: ${this.top};` : ''
38
+ const bottomSys = this.bottom ? `bottom: ${this.bottom};` : ''
39
+ const leftSys = this.left ? `left: ${this.left};` : ''
40
+ const rightSys = this.right ? `right: ${this.right};` : ''
41
+ return `${topSys}${bottomSys}${leftSys}${rightSys}`
29
42
  }
30
43
  },
31
44
  watch: {
@@ -39,10 +52,13 @@ export default {
39
52
  },
40
53
  methods: {
41
54
  open () {
42
- this.top = 0
43
- this.left = 0
55
+ this.top = ''
56
+ this.bottom = ''
57
+ this.left = ''
58
+ this.right = ''
44
59
  const value = true
45
60
  this.showTip = value
61
+ this.updateStyle()
46
62
  this.$emit('input', value)
47
63
  },
48
64
  close () {
@@ -51,23 +67,11 @@ export default {
51
67
  this.$emit('input', value)
52
68
  },
53
69
  updateStyle () {
54
- if (this.placement === 'top') {
55
- this.left = '-20rpx'
56
- }
57
- if (this.placement === 'top-start') {
58
- this.left = '-20rpx'
59
- }
60
- if (this.placement === 'top-end') {
61
- this.left = '-20rpx'
70
+ if (['top-start', 'bottom-start'].includes(this.placement)) {
71
+ this.left = '0'
62
72
  }
63
- if (this.placement === 'bottom') {
64
- this.left = '-20rpx'
65
- }
66
- if (this.placement === 'bottom-start') {
67
- this.left = '-20rpx'
68
- }
69
- if (this.placement === 'bottom-end') {
70
- this.left = '-20rpx'
73
+ if (['top-end', 'bottom-end'].includes(this.placement)) {
74
+ this.right = '0'
71
75
  }
72
76
  },
73
77
  toggleVisible () {
@@ -78,6 +82,9 @@ export default {
78
82
  this.open()
79
83
  }
80
84
  }
85
+ },
86
+ closeEvent () {
87
+ this.close()
81
88
  }
82
89
  }
83
90
  }
@@ -92,5 +99,45 @@ export default {
92
99
  display: inline-block;
93
100
  vertical-align: middle;
94
101
  }
102
+ &.placement-bottom,
103
+ &.placement-top {
104
+ .ml-tooltip-popup {
105
+ left: 50%;
106
+ transform: translateX(-50%);
107
+ }
108
+ }
109
+ &.placement-bottom-start,
110
+ &.placement-top-start {
111
+ .ml-tooltip-popup {
112
+ text-align: left;
113
+ }
114
+ }
115
+ &.placement-bottom-end,
116
+ &.placement-top-end {
117
+ .ml-tooltip-popup {
118
+ text-align: right;
119
+ }
120
+ }
121
+ &.placement-bottom,
122
+ &.placement-bottom-start,
123
+ &.placement-bottom-end {
124
+ .ml-tooltip-popup {
125
+ top: 100%;
126
+ }
127
+ }
128
+ &.placement-top,
129
+ &.placement-top-start,
130
+ &.placement-top-end {
131
+ .ml-tooltip-popup {
132
+ bottom: 100%;
133
+ }
134
+ }
135
+ }
136
+ .ml-tooltip-popup {
137
+ position: absolute;
138
+ z-index: 900;
139
+ width: 80vw;
140
+ padding: 15rpx 0;
141
+ pointer-events: none;
95
142
  }
96
143
  </style>
@@ -1,11 +1,14 @@
1
1
  <template>
2
- <view class="ml-tooltip-view" :class="[className || '', `placement-${placement || 'bottom'}`]" :style="tipStyles">
2
+ <view class="ml-tooltip-view" :class="[className || '', `placement-${placement || 'bottom'}`, {'show-close': showClose}]" :style="tipStyles">
3
3
  <view class="ml-tooltip-warpper">
4
4
  <view class="ml-tooltip-title">
5
5
  <slow name="title">
6
6
  <text>{{ title }}</text>
7
7
  </slow>
8
8
  </view>
9
+ <view v-if="showClose" class="ml-tooltip-close-btn" @tap="closeEvent">
10
+ <ml-icon name="close" />
11
+ </view>
9
12
  <view class="ml-tooltip-arrows">
10
13
  <ml-icon v-if="placement === 'bottom-start'" name="arrow-up-filling" />
11
14
  <ml-icon v-else-if="placement === 'bottom'" name="arrow-up-filling" />
@@ -35,6 +38,7 @@ export default {
35
38
  left: String,
36
39
  bottom: String,
37
40
  right: String,
41
+ showClose: Boolean,
38
42
  placement: String,
39
43
  className: String
40
44
  },
@@ -48,32 +52,65 @@ export default {
48
52
  const wSys = this.width ? `width: ${this.width};` : ''
49
53
  return `${posSys}${topSys}${bottomSys}${leftSys}${rightSys}${wSys}`
50
54
  }
55
+ },
56
+ methods: {
57
+ closeEvent () {
58
+ this.$emit('close', {})
59
+ }
51
60
  }
52
61
  }
53
62
  </script>
54
63
 
55
64
  <style lang="scss">
56
65
  .ml-tooltip-view {
66
+ position: relative;
57
67
  z-index: 900;
58
- width: 300rpx;
68
+ width: 80vw;
69
+ pointer-events: none;
59
70
  .ml-tooltip-warpper {
60
71
  position: relative;
61
72
  display: inline-block;
62
73
  color: #FFFFFF;
63
74
  white-space: nowrap;
75
+ text-align: left;
76
+ pointer-events: auto;
64
77
  padding: $ml-page-interval-margin 24rpx;
65
- background: rgba(0, 0, 0, 0.85);
78
+ background-color: rgba(69, 72, 74, 0.9);
66
79
  border-radius: $ml-border-radius;
67
- max-width: 80vw;
68
80
  }
69
81
  .ml-tooltip-title {
70
82
  white-space: pre-wrap;
71
83
  }
72
84
  .ml-tooltip-arrows {
73
85
  position: absolute;
74
- color: rgba(0, 0, 0, 0.85);
86
+ color: rgba(69, 72, 74, 0.9);
87
+ font-size: 32rpx;
88
+ }
89
+ .ml-tooltip-close-btn {
90
+ position: absolute;
91
+ width: 40rpx;
92
+ height: 40rpx;
93
+ line-height: 40rpx;
94
+ color: #ffffff;
95
+ text-align: center;
75
96
  font-size: 32rpx;
76
97
  }
98
+ &.show-close {
99
+ &.placement-top,
100
+ &.placement-top-start,
101
+ &.placement-top-end,
102
+ &.placement-bottom,
103
+ &.placement-bottom-start,
104
+ &.placement-bottom-end {
105
+ .ml-tooltip-warpper {
106
+ padding-right: 60rpx;
107
+ }
108
+ .ml-tooltip-close-btn {
109
+ right: 10rpx;
110
+ top: 10rpx;
111
+ }
112
+ }
113
+ }
77
114
  &.placement-bottom,
78
115
  &.placement-bottom-start,
79
116
  &.placement-bottom-end {
@@ -100,7 +137,6 @@ export default {
100
137
  right: 10rpx;
101
138
  }
102
139
  }
103
-
104
140
  &.placement-top,
105
141
  &.placement-top-start,
106
142
  &.placement-top-end {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.2.97",
3
+ "version": "0.2.99",
4
4
  "description": "码里云小程序组件库",
5
5
  "scripts": {
6
6
  "release": "node script/release.js && npm publish"