no message

Former-commit-id: 472e0206c5cb57e49b4a124110cd872a6f192071
Former-commit-id: 98ea5d9855933541ef37ea91bf7c9506d5ebd1e0
Former-commit-id: cd7131a3ed7abdf2bdda87185fd2028199d337a7
This commit is contained in:
李杨
2018-02-17 22:04:55 +08:00
parent 61976a74b7
commit 8e56ad4a72
2 changed files with 13 additions and 4 deletions

View File

@@ -30,9 +30,12 @@ export default {
mounted () { mounted () {
// 如果设置了在 mounted 后自动初始化 就在这里初始化 // 如果设置了在 mounted 后自动初始化 就在这里初始化
if (this.autoInit) { if (this.autoInit) {
// 可以设置延时初始化
setTimeout(() => {
this.$nextTick(() => { this.$nextTick(() => {
this.init() this.init()
}) })
}, this.autoInitDelay)
} }
}, },
watch: { watch: {

View File

@@ -11,10 +11,16 @@ export default {
required: false, required: false,
default: false default: false
}, },
// 在组件 mounted 后立即初始化图表 (非G2自带) // 在组件 mounted 后自动初始化图表 (非G2自带)
autoInit: { autoInit: {
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: true
},
// 在组件 mounted 后自动初始化图表的延时 (非G2自带)
autoInitDelay: {
type: Number,
required: false,
default: 0
} }
} }