mali-applet-ui 0.0.98 → 0.0.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.
@@ -1,6 +1,6 @@
1
1
  <template>
2
- <view class="ml-popup" :class="[className || '', {'is-visible': value}]">
3
- <view v-if="value" class="ml-popup-warpper">
2
+ <view class="ml-popup" :class="[className || '', {'is-visible': visible, 'is-animate': isAnimate}]">
3
+ <view v-if="visible" class="ml-popup-warpper">
4
4
  <view v-if="showHeader" class="ml-popup-header">
5
5
  <slot name="header">
6
6
  <view v-if="title" class="ml-popup-header-title">{{ title }}</view>
@@ -10,8 +10,8 @@
10
10
  <slot></slot>
11
11
  </view>
12
12
  <view v-if="showConfirmButton || showCancelButton" class="ml-popup-footer">
13
- <ml-button width="40%" round>{{ cancelButtonText }}</ml-button>
14
- <ml-button status="primary" width="40%" round>{{ confirmButtonText }}</ml-button>
13
+ <ml-button width="40%" round @click="cancelEvent">{{ cancelButtonText }}</ml-button>
14
+ <ml-button status="primary" width="40%" round @click="confirmEvent">{{ confirmButtonText }}</ml-button>
15
15
  </view>
16
16
  </view>
17
17
  </view>
@@ -33,24 +33,69 @@ export default {
33
33
  type: String,
34
34
  default: '确认'
35
35
  },
36
+ confirmClosable: Boolean,
36
37
  showCancelButton: Boolean,
37
38
  cancelButtonText: {
38
39
  type: String,
39
40
  default: '取消'
40
41
  },
42
+ cancelClosable: {
43
+ type: Boolean,
44
+ default: true
45
+ },
41
46
  className: String
42
47
  },
48
+ data () {
49
+ return {
50
+ visible: false,
51
+ isAnimate: false
52
+ }
53
+ },
43
54
  computed: {
44
55
  bodyStyles () {
45
56
  return this.height ? `height:${this.height};` : ''
46
57
  }
47
58
  },
59
+ watch: {
60
+ value (val) {
61
+ if (val) {
62
+ this.open()
63
+ } else {
64
+ this.close()
65
+ }
66
+ }
67
+ },
68
+ created () {
69
+ this.$nextTick(() => {
70
+ if (this.value) {
71
+ this.open()
72
+ } else {
73
+ this.close()
74
+ }
75
+ })
76
+ },
48
77
  methods: {
49
78
  close () {
50
-
79
+ this.isAnimate = false
80
+ setTimeout(() => {
81
+ this.visible = false
82
+ }, 300)
51
83
  },
52
84
  open () {
53
-
85
+ this.visible = true
86
+ this.$nextTick(() => {
87
+ this.isAnimate = true
88
+ })
89
+ },
90
+ cancelEvent () {
91
+ if (this.cancelClosable) {
92
+ this.close()
93
+ }
94
+ },
95
+ confirmEvent () {
96
+ if (this.confirmClosable) {
97
+ this.close()
98
+ }
54
99
  }
55
100
  }
56
101
  }
@@ -68,6 +113,8 @@ export default {
68
113
  background-color: rgba(0, 0, 0, 0.4);
69
114
  &.is-visible {
70
115
  display: block;
116
+ }
117
+ &.is-animate {
71
118
  .ml-popup-warpper {
72
119
  transform: translateY(0);
73
120
  }
@@ -143,10 +143,17 @@ export default {
143
143
  })
144
144
  this.selectUniFileList = this.urlList.map(url => {
145
145
  const name = this.getUrlName(url)
146
+ const extname = this.getSuffix(name)
147
+ const obj = {
148
+ [this.nameField]: name,
149
+ [this.typeField]: extname,
150
+ [this.urlField]: url
151
+ }
146
152
  return {
153
+ ...obj,
147
154
  name: name,
148
- extname: this.getSuffix(name),
149
- url: url
155
+ extname: extname,
156
+ url: this.getUrl(obj)
150
157
  }
151
158
  })
152
159
  this.isUpdate = true
@@ -158,9 +165,10 @@ export default {
158
165
  })
159
166
  this.selectUniFileList = this.value.map(item => {
160
167
  return {
168
+ ...item,
161
169
  name: item[this.nameField],
162
170
  extname: item[this.typeField],
163
- url: item[this.urlField]
171
+ url: this.getUrl(item)
164
172
  }
165
173
  })
166
174
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.0.98",
3
+ "version": "0.0.99",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",