Demo:支持设置关联线的样式,即实线或虚线

This commit is contained in:
街角小林 2024-08-12 13:36:42 +08:00
parent 3801dc3ec4
commit f15bf8a8dc
3 changed files with 56 additions and 1 deletions

View File

@ -83,6 +83,10 @@ export const borderDasharrayList = [
{ {
name: 'Dotted6', name: 'Dotted6',
value: '1, 5' value: '1, 5'
},
{
name: 'Dotted7',
value: '6, 4'
} }
] ]

View File

@ -133,6 +133,10 @@ export const borderDasharrayList = [
{ {
name: '虚线6', name: '虚线6',
value: '1, 5' value: '1, 5'
},
{
name: '虚线7',
value: '6, 4'
} }
] ]

View File

@ -469,6 +469,47 @@
</el-select> </el-select>
</div> </div>
</div> </div>
<div class="row">
<div class="rowItem">
<span class="name">{{ $t('style.style') }}</span>
<el-select
size="mini"
style="width: 80px"
v-model="style.associativeLineDasharray"
placeholder=""
@change="
value => {
update('associativeLineDasharray', value)
}
"
>
<el-option
v-for="item in borderDasharrayList"
:key="item.value"
:label="item.name"
:value="item.value"
>
<svg width="120" height="34">
<line
x1="10"
y1="17"
x2="110"
y2="17"
stroke-width="2"
:stroke="
style.associativeLineDasharray === item.value
? '#409eff'
: isDark
? '#fff'
: '#000'
"
:stroke-dasharray="item.value"
></line>
</svg>
</el-option>
</el-select>
</div>
</div>
<!-- 关联线文字 --> <!-- 关联线文字 -->
<div class="title noTop">{{ $t('baseStyle.associativeLineText') }}</div> <div class="title noTop">{{ $t('baseStyle.associativeLineText') }}</div>
<div class="row"> <div class="row">
@ -1003,7 +1044,8 @@ import {
fontFamilyList, fontFamilyList,
fontSizeList, fontSizeList,
rootLineKeepSameInCurveList, rootLineKeepSameInCurveList,
lineStyleMap lineStyleMap,
borderDasharrayList
} from '@/config' } from '@/config'
import ImgUpload from '@/components/ImgUpload' import ImgUpload from '@/components/ImgUpload'
import { storeConfig } from '@/api' import { storeConfig } from '@/api'
@ -1058,6 +1100,7 @@ export default {
associativeLineColor: '', associativeLineColor: '',
associativeLineWidth: 0, associativeLineWidth: 0,
associativeLineActiveWidth: 0, associativeLineActiveWidth: 0,
associativeLineDasharray: '',
associativeLineActiveColor: '', associativeLineActiveColor: '',
associativeLineTextFontSize: 0, associativeLineTextFontSize: 0,
associativeLineTextColor: '', associativeLineTextColor: '',
@ -1168,6 +1211,9 @@ export default {
}, },
showRootLineKeepSameInCurveLayouts() { showRootLineKeepSameInCurveLayouts() {
return supportRootLineKeepSameInCurveLayouts.includes(this.currentLayout) return supportRootLineKeepSameInCurveLayouts.includes(this.currentLayout)
},
borderDasharrayList() {
return borderDasharrayList[this.$i18n.locale] || borderDasharrayList.zh
} }
}, },
watch: { watch: {
@ -1233,6 +1279,7 @@ export default {
'associativeLineColor', 'associativeLineColor',
'associativeLineWidth', 'associativeLineWidth',
'associativeLineActiveWidth', 'associativeLineActiveWidth',
'associativeLineDasharray',
'associativeLineActiveColor', 'associativeLineActiveColor',
'associativeLineTextFontSize', 'associativeLineTextFontSize',
'associativeLineTextColor', 'associativeLineTextColor',