2019-08-22 14:41:07 +08:00
|
|
|
<template>
|
|
|
|
<div class="dv-border-box-3" :ref="ref">
|
|
|
|
<svg class="dv-border-svg-container" :width="width" :height="height">
|
|
|
|
<polyline class="dv-bb3-line1"
|
2019-12-06 21:07:16 +08:00
|
|
|
:stroke="mergedColor[0]"
|
|
|
|
:points="`4, 4 ${width - 22} ,4 ${width - 22}, ${height - 22} 4, ${height - 22} 4, 4`"
|
|
|
|
/>
|
2019-08-22 14:41:07 +08:00
|
|
|
<polyline class="dv-bb3-line2"
|
2019-12-06 21:07:16 +08:00
|
|
|
:stroke="mergedColor[1]"
|
|
|
|
:points="`10, 10 ${width - 16}, 10 ${width - 16}, ${height - 16} 10, ${height - 16} 10, 10`"
|
|
|
|
/>
|
2019-08-22 14:41:07 +08:00
|
|
|
<polyline class="dv-bb3-line2"
|
2019-12-06 21:07:16 +08:00
|
|
|
:stroke="mergedColor[1]"
|
|
|
|
:points="`16, 16 ${width - 10}, 16 ${width - 10}, ${height - 10} 16, ${height - 10} 16, 16`"
|
|
|
|
/>
|
2019-08-22 14:41:07 +08:00
|
|
|
<polyline class="dv-bb3-line2"
|
2019-12-06 21:07:16 +08:00
|
|
|
:stroke="mergedColor[1]"
|
|
|
|
:points="`22, 22 ${width - 4}, 22 ${width - 4}, ${height - 4} 22, ${height - 4} 22, 22`"
|
|
|
|
/>
|
2019-08-22 14:41:07 +08:00
|
|
|
</svg>
|
|
|
|
|
|
|
|
<div class="border-box-content">
|
|
|
|
<slot></slot>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import autoResize from '../../../mixin/autoResize'
|
|
|
|
|
2019-12-06 21:07:16 +08:00
|
|
|
import { deepMerge } from '@jiaminghi/charts/lib/util/index'
|
|
|
|
|
|
|
|
import { deepClone } from '@jiaminghi/c-render/lib/plugin/util'
|
|
|
|
|
2019-08-22 14:41:07 +08:00
|
|
|
export default {
|
|
|
|
name: 'DvBorderBox3',
|
|
|
|
mixins: [autoResize],
|
2019-12-06 21:07:16 +08:00
|
|
|
props: {
|
|
|
|
color: {
|
|
|
|
type: Array,
|
|
|
|
default: () => ([])
|
|
|
|
}
|
|
|
|
},
|
2019-08-22 14:41:07 +08:00
|
|
|
data () {
|
|
|
|
return {
|
2019-12-06 21:07:16 +08:00
|
|
|
ref: 'border-box-3',
|
|
|
|
|
|
|
|
defaultColor: ['#2862b7', '#2862b7'],
|
|
|
|
|
|
|
|
mergedColor: []
|
2019-08-22 14:41:07 +08:00
|
|
|
}
|
2019-12-06 21:07:16 +08:00
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
color () {
|
|
|
|
const { mergeColor } = this
|
|
|
|
|
|
|
|
mergeColor()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
mergeColor () {
|
|
|
|
const { color, defaultColor } = this
|
|
|
|
|
|
|
|
this.mergedColor = deepMerge(deepClone(defaultColor, true), color || [])
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
const { mergeColor } = this
|
|
|
|
|
|
|
|
mergeColor()
|
2019-08-22 14:41:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|