no message

Former-commit-id: 34bfc333be64a3f8f774f49a571be0db887098b1
Former-commit-id: 31b3d27fe5719fea3583f80f1498cd19b214b644
Former-commit-id: 1e07d94e6e1a349f538703ea6a5b04b2b65d1ac6
This commit is contained in:
李杨
2018-02-17 22:30:49 +08:00
parent 54450481e2
commit 5c2055d113
4 changed files with 34 additions and 14 deletions

View File

@@ -7,6 +7,9 @@ import propsChart from './props/chart'
// 扩展属性
import propsD2 from './props/d2'
// 工具
import sleep from '@/utils/sleep.js'
// 关闭 G2 的体验改进计划打点请求
G2.track(false)
@@ -27,15 +30,15 @@ export default {
chart: null
}
},
mounted () {
async mounted () {
// 如果设置了在 mounted 后自动初始化 就在这里初始化
if (this.autoInit) {
// 可以设置延时初始化 默认时间为 0
setTimeout(() => {
this.$nextTick(() => {
this.init()
})
}, this.autoInitDelay)
// 延时
await sleep(this.autoInitDelay)
// 初始化
this.$nextTick(() => {
this.init()
})
}
},
watch: {

View File

@@ -4,6 +4,7 @@
<span class="dd-fr">
<Icon
class="chart-card-header-icon"
:class="{active}"
name="refresh"
@click.native="handleRefresh">
</Icon>
@@ -20,8 +21,17 @@ export default {
default: ''
}
},
data () {
return {
active: false
}
},
methods: {
handleRefresh () {
this.active = true
setTimeout(() => {
this.active = false
}, 1000)
this.$emit('refresh')
}
}
@@ -32,6 +42,10 @@ export default {
@import '~@/assets/style/public.scss';
.chart-card-header-icon {
color: $color-text-sub;
transition: all .3s;
&.active {
transform: rotate(360deg);
}
}
</style>

View File

@@ -68,12 +68,6 @@ export default {
})
}))
},
// 更新指定的图表
chartResize (name) {
this.$nextTick(() => {
this.$refs[name].resize()
})
},
// 布局组件发生变化
layoutUpdatedHandler (newLayout) {
console.group('layoutUpdatedHandler')
@@ -84,7 +78,9 @@ export default {
},
// 改变尺寸完成
handleResized (name) {
this.chartResize(name)
this.$nextTick(() => {
this.$refs[name].resize()
})
},
// 用户触发了卡片右上角的刷新按钮
handleRefreshData (index) {

7
src/utils/sleep.js Normal file
View File

@@ -0,0 +1,7 @@
export default async (time = 0) => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
})
}