Compare commits

...

5 Commits

Author SHA1 Message Date
72433f8ff1 update version to 2.3.1 2019-07-04 17:12:29 +08:00
9c1ef5ed3b update change log 2019-07-04 17:12:10 +08:00
4ac3ad8c5b Fix potential rendering exceptions. 2019-07-04 17:12:04 +08:00
658537f155 Enhanced style compatibility. 2019-07-04 17:11:54 +08:00
6f784a3e36 Strengthen autoResize stability 2019-07-04 17:11:32 +08:00
6 changed files with 49 additions and 39 deletions

View File

@ -1,3 +1,12 @@
# 2.3.1-alpha (2019-07-04)
### Perfect
- **charts:** Enhanced style compatibility.
- **scrollBoard:** Enhanced style compatibility.
- **fullScreenContainer:** Fix potential rendering exceptions.
- **mixin:** Strengthen `autoResize` stability.
# 2.3.0-alpha (2019-07-04) # 2.3.0-alpha (2019-07-04)
### Directory Structure Change ### Directory Structure Change

View File

@ -1,6 +1,6 @@
{ {
"name": "@jiaminghi/data-view", "name": "@jiaminghi/data-view",
"version": "2.3.0", "version": "2.3.1",
"author": "JiaMing <743192023@qq.com>", "author": "JiaMing <743192023@qq.com>",
"description": "Vue Large screen data display component library", "description": "Vue Large screen data display component library",
"main": "/lib/index.js", "main": "/lib/index.js",

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="dv-charts-container" :ref="ref"> <div class="dv-charts-container" :ref="ref">
<div class="charts" :ref="chartRef" /> <div class="charts-canvas-container" :ref="chartRef" />
</div> </div>
</template> </template>
@ -30,6 +30,8 @@ export default {
option () { option () {
let { chart, option } = this let { chart, option } = this
if (!chart) return
if (!option) option = {} if (!option) option = {}
chart.setOption(option) chart.setOption(option)
@ -67,7 +69,7 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
.charts { .charts-canvas-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }

View File

@ -1,57 +1,57 @@
<template> <template>
<div id="dv-full-screen-container" ref="full-screen-container"> <div id="dv-full-screen-container" :ref="ref">
<template v-if="ready">
<slot></slot> <slot></slot>
</template>
</div> </div>
</template> </template>
<script> <script>
import autoResize from '../../../mixin/autoResize.js'
export default { export default {
name: 'DvFullScreenContainer', name: 'DvFullScreenContainer',
mixins: [autoResize],
data () { data () {
return { return {
ref: 'full-screen-container',
allWidth: 0,
scale: 0, scale: 0,
datavRoot: '' datavRoot: '',
ready: false
} }
}, },
methods: { methods: {
init () { afterAutoResizeMixinInit () {
const { initConfig, setAppScale, bindReSizeEventHandler } = this const { initConfig, setAppScale } = this
initConfig() initConfig()
setAppScale() setAppScale()
bindReSizeEventHandler() this.ready = true
}, },
initConfig () { initConfig () {
const { dom } = this
const { width, height } = screen const { width, height } = screen
this.allWidth = width this.allWidth = width
const datavRoot = this.datavRoot = this.$refs['full-screen-container'] dom.style.width = `${width}px`
dom.style.height = `${height}px`
datavRoot.style.width = `${width}px`
datavRoot.style.height = `${height}px`
}, },
setAppScale () { setAppScale () {
const { allWidth, datavRoot } = this const { allWidth, dom } = this
const currentWidth = document.body.clientWidth const currentWidth = document.body.clientWidth
datavRoot.style.transform = `scale(${currentWidth / allWidth})` dom.style.transform = `scale(${currentWidth / allWidth})`
}, },
bindReSizeEventHandler () { onResize () {
const { debounce, setAppScale } = this const { setAppScale } = this
if (!debounce) return setAppScale()
window.addEventListener('resize', debounce(100, setAppScale))
} }
},
mounted () {
const { init } = this
init()
} }
} }
</script> </script>

View File

@ -1,12 +1,11 @@
<template> <template>
<div class="dv-scroll-board" :ref="ref"> <div class="dv-scroll-board" :ref="ref">
<div class="header" v-if="header.length && mergedConfig"> <div class="header" v-if="header.length && mergedConfig" :style="`background-color: ${mergedConfig.headerBGC};`">
<div <div
class="header-item" class="header-item"
v-for="(headerItem, i) in header" v-for="(headerItem, i) in header"
:key="headerItem + i" :key="headerItem + i"
:style="` :style="`
background-color: ${mergedConfig.headerBGC};
height: ${mergedConfig.headerHeight}px; height: ${mergedConfig.headerHeight}px;
line-height: ${mergedConfig.headerHeight}px; line-height: ${mergedConfig.headerHeight}px;
width: ${widths[i]}px; width: ${widths[i]}px;
@ -19,7 +18,7 @@
<div <div
v-if="mergedConfig" v-if="mergedConfig"
class="rows" class="rows"
:style="`height: calc(100% - ${header.length ? mergedConfig.headerHeight : 0}px);`" :style="`height: ${height - (header.length ? mergedConfig.headerHeight : 0)}px;`"
> >
<div <div
class="row-item" class="row-item"
@ -357,20 +356,20 @@ export default {
</script> </script>
<style lang="less"> <style lang="less">
.text {
padding: 0 10px;
box-sizing: border-box;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.dv-scroll-board { .dv-scroll-board {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
color: #fff; color: #fff;
.text {
padding: 0 10px;
box-sizing: border-box;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.header { .header {
display: flex; display: flex;
flex-direction: row; flex-direction: row;

View File

@ -17,7 +17,7 @@ export default {
async autoResizeMixinInit () { async autoResizeMixinInit () {
const { initWH, getDebounceInitWHFun, bindDomResizeCallback, afterAutoResizeMixinInit } = this const { initWH, getDebounceInitWHFun, bindDomResizeCallback, afterAutoResizeMixinInit } = this
await initWH() await initWH(false)
getDebounceInitWHFun() getDebounceInitWHFun()
@ -25,7 +25,7 @@ export default {
if (typeof afterAutoResizeMixinInit === 'function') afterAutoResizeMixinInit() if (typeof afterAutoResizeMixinInit === 'function') afterAutoResizeMixinInit()
}, },
initWH () { initWH (resize = true) {
const { $nextTick, $refs, ref, onResize } = this const { $nextTick, $refs, ref, onResize } = this
return new Promise(resolve => { return new Promise(resolve => {
@ -35,7 +35,7 @@ export default {
this.width = dom.clientWidth this.width = dom.clientWidth
this.height = dom.clientHeight this.height = dom.clientHeight
if (typeof onResize === 'function') onResize() if (typeof onResize === 'function' && resize) onResize()
resolve() resolve()
}) })