@aochuang/client-sdk 1.0.283 → 1.0.284

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.
@@ -104,7 +104,6 @@ export default {
104
104
  data () {
105
105
  return {
106
106
  pageSize: 40,
107
- tuckReady: false,
108
107
  allowTuck: false,
109
108
  loading: false
110
109
  }
@@ -190,17 +189,24 @@ export default {
190
189
  },
191
190
  watch: {
192
191
  lastStickyOnTopSession () {
193
- this.delayCheckAllowTuck()
192
+ this.checkAllowTuckAfterRender()
193
+ },
194
+ tucked () {
195
+ this.checkAllowTuckAfterRender()
196
+ },
197
+ sessionListData () {
198
+ this.checkAllowTuckAfterRender()
194
199
  }
195
200
  },
196
201
  mounted () {
197
- this.resizeObserver = new ResizeObserver(entries => {
202
+ this.resizeObserver = new ResizeObserver(() => {
198
203
  this.delayCheckAllowTuck()
199
204
  })
200
- this.resizeObserver.observe(this.$el)
205
+ this.observeTuckTarget()
201
206
  if (this.autoLoad) {
202
207
  this.$refs.loadMore.reload()
203
208
  }
209
+ this.checkAllowTuckAfterRender()
204
210
  },
205
211
  methods: {
206
212
  reload () {
@@ -208,7 +214,6 @@ export default {
208
214
  return
209
215
  }
210
216
  return this.$refs.loadMore.reload().then(() => {
211
- this.tuckReady = true
212
217
  this.delayCheckAllowTuck()
213
218
  })
214
219
  },
@@ -221,13 +226,33 @@ export default {
221
226
  scrollTop (top) {
222
227
  this.$refs.loadMore.scrollTop(top)
223
228
  },
224
- delayCheckAllowTuck () {
225
- if (!this.tuckReady) {
229
+ observeTuckTarget () {
230
+ if (!this.resizeObserver || !this.$el) {
226
231
  return
227
232
  }
233
+ this.resizeObserver.disconnect()
234
+ this.resizeObserver.observe(this.$el)
235
+ if (this.$refs.loadMore && this.$refs.loadMore.$el && this.$refs.loadMore.$el !== this.$el) {
236
+ this.resizeObserver.observe(this.$refs.loadMore.$el)
237
+ }
238
+ if (this.lastStickyOnTopSession) {
239
+ const $lastStickyOnTopEls = this.$refs['item-' + this.lastStickyOnTopSession[this.idField]]
240
+ if ($lastStickyOnTopEls && $lastStickyOnTopEls.length) {
241
+ this.resizeObserver.observe($lastStickyOnTopEls[0])
242
+ }
243
+ }
244
+ },
245
+ checkAllowTuckAfterRender () {
246
+ this.$nextTick(() => {
247
+ this.observeTuckTarget()
248
+ this.delayCheckAllowTuck()
249
+ })
250
+ },
251
+ delayCheckAllowTuck () {
228
252
  clearTimeout(this._checkTimer)
229
253
  this._checkTimer = setTimeout(() => {
230
- if (!this.tuckable) {
254
+ if (!this.tuckable || !this.$el) {
255
+ this.allowTuck = false
231
256
  return
232
257
  }
233
258
  if (this.tucked) {
@@ -298,7 +323,9 @@ export default {
298
323
  }
299
324
  },
300
325
  beforeDestroy () {
301
- this.resizeObserver && this.resizeObserver.unobserve(this.$el)
326
+ clearTimeout(this._checkTimer)
327
+ this.resizeObserver && this.resizeObserver.disconnect()
328
+ this.resizeObserver = null
302
329
  }
303
330
  }
304
331
  </script>
@@ -321,6 +348,7 @@ export default {
321
348
  align-items: center;
322
349
  transition: background-color .25s;
323
350
  cursor: pointer;
351
+ z-index: 3;
324
352
  &:hover {
325
353
  &:not(.is-loading) {
326
354
  background-color: #ddd;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/client-sdk",
3
- "version": "1.0.283",
3
+ "version": "1.0.284",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"