|
|
@@ -226,15 +226,15 @@ export default {
|
|
|
} catch (e) {
|
|
|
this.dpr = 1
|
|
|
}
|
|
|
- setTimeout(function() {
|
|
|
+ this.$nextTick(function() {
|
|
|
if (self._destroyed) return
|
|
|
self.updateCanvasSize()
|
|
|
- setTimeout(function() {
|
|
|
+ self.$nextTick(function() {
|
|
|
if (!self._destroyed) {
|
|
|
self.initSimulation()
|
|
|
}
|
|
|
- }, 80)
|
|
|
- }, 40)
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
beforeDestroy: function() {
|
|
|
this._destroyed = true
|
|
|
@@ -723,12 +723,14 @@ export default {
|
|
|
var self = this
|
|
|
var cnt = this.members ? this.members.length : 0
|
|
|
self.canvasHeight = Math.max(200, cnt * 90)
|
|
|
- var query = uni.createSelectorQuery().in(this)
|
|
|
- query.select('.family-graph-wrapper').boundingClientRect(function(rect) {
|
|
|
- if (rect) {
|
|
|
+ uni.createSelectorQuery().in(this)
|
|
|
+ .select('.family-graph-wrapper')
|
|
|
+ .boundingClientRect(function(rect) {
|
|
|
+ if (!self._destroyed && rect) {
|
|
|
self.canvasWidth = rect.width || 340
|
|
|
}
|
|
|
- }).exec()
|
|
|
+ })
|
|
|
+ .exec()
|
|
|
}
|
|
|
}
|
|
|
}
|