2019-08-22 14:41:07 +08:00
|
|
|
<template>
|
|
|
|
<div class="dv-border-box-2" :ref="ref">
|
|
|
|
<svg class="dv-border-svg-container" :width="width" :height="height">
|
2019-12-06 21:07:16 +08:00
|
|
|
<polyline
|
|
|
|
:stroke="mergedColor[0]"
|
|
|
|
:points="`2, 2 ${width - 2} ,2 ${width - 2}, ${height - 2} 2, ${height - 2} 2, 2`"
|
|
|
|
/>
|
|
|
|
<polyline
|
|
|
|
:stroke="mergedColor[1]"
|
|
|
|
:points="`6, 6 ${width - 6}, 6 ${width - 6}, ${height - 6} 6, ${height - 6} 6, 6`"
|
|
|
|
/>
|
|
|
|
<circle :fill="mergedColor[0]" cx="11" cy="11" r="1" />
|
|
|
|
<circle :fill="mergedColor[0]" :cx="width - 11" cy="11" r="1" />
|
|
|
|
<circle :fill="mergedColor[0]" :cx="width - 11" :cy="height - 11" r="1" />
|
|
|
|
<circle :fill="mergedColor[0]" cx="11" :cy="height - 11" r="1" />
|
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: 'DvBorderBox2',
|
|
|
|
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-2',
|
|
|
|
|
|
|
|
defaultColor: ['#fff', 'rgba(255, 255, 255, 0.6)'],
|
|
|
|
|
|
|
|
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>
|