style: 优化水球图代码结构

This commit is contained in:
奔跑的面条 2022-06-13 17:30:17 +08:00
parent bfa16ec438
commit a71bd16103
2 changed files with 34 additions and 34 deletions

View File

@ -3,6 +3,37 @@ import { CreateComponentType } from '@/packages/index.d'
import { WaterPoloConfig } from './index' import { WaterPoloConfig } from './index'
import cloneDeep from 'lodash/cloneDeep' import cloneDeep from 'lodash/cloneDeep'
export const shapes = [
{
label: '圆形',
value: 'circle'
},
{
label: '正方形',
value: 'rect'
},
{
label: '带圆角的正方形',
value: 'roundRect'
},
{
label: '正三角形',
value: 'triangle'
},
{
label: '菱形',
value: 'diamond'
},
{
label: '水滴',
value: 'pin'
},
{
label: '箭头',
value: 'arrow'
},
]
export const includes = [] export const includes = []
export const option = { export const option = {
@ -10,7 +41,7 @@ export const option = {
series: [ series: [
{ {
type: 'liquidFill', type: 'liquidFill',
shape: 'circle', shape: shapes[0].value,
radius: '90%', radius: '90%',
data: [0], data: [0],
center: ['50%', '50%'], center: ['50%', '50%'],

View File

@ -18,7 +18,7 @@
<SettingItem name="形状"> <SettingItem name="形状">
<n-select v-model:value="item.shape" :options="shapes" placeholder="选择形状" /> <n-select v-model:value="item.shape" :options="shapes" placeholder="选择形状" />
</SettingItem> </SettingItem>
<SettingItem name="文字大小"> <SettingItem name="文">
<n-input-number v-model:value="item.label.normal.textStyle.fontSize" :min="0" :step="1" size="small" placeholder="文字大小"> <n-input-number v-model:value="item.label.normal.textStyle.fontSize" :min="0" :step="1" size="small" placeholder="文字大小">
</n-input-number> </n-input-number>
</SettingItem> </SettingItem>
@ -51,7 +51,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { PropType, computed } from 'vue' import { PropType, computed } from 'vue'
import { option } from './config' import { option, shapes } from './config'
import { import {
CollapseItem, CollapseItem,
SettingItemBox, SettingItemBox,
@ -68,35 +68,4 @@ const props = defineProps({
const seriesList = computed(() => { const seriesList = computed(() => {
return props.optionData.series return props.optionData.series
}) })
const shapes = [
{
label: '圆形',
value: 'circle'
},
{
label: '正方形',
value: 'rect'
},
{
label: '带圆角的正方形',
value: 'roundRect'
},
{
label: '正三角形',
value: 'triangle'
},
{
label: '菱形',
value: 'diamond'
},
{
label: '水滴',
value: 'pin'
},
{
label: '箭头',
value: 'arrow'
},
]
</script> </script>