mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 00:02:51 +08:00
feat: 新增装饰组件01
This commit is contained in:
parent
bb78d89037
commit
d1ea05c2c0
Binary file not shown.
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.9 KiB |
@ -4,8 +4,10 @@ import { Decorates01Config } from './index'
|
|||||||
import cloneDeep from 'lodash/cloneDeep'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
|
|
||||||
export const option = {
|
export const option = {
|
||||||
colors: ['#4fd2dd', '#235fa7'],
|
colors: ['#3faacb', '#fff'],
|
||||||
backgroundColor: '#00000000'
|
dur: 3,
|
||||||
|
lineHeight: 2,
|
||||||
|
endWidth: 5
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Config extends publicConfig implements CreateComponentType {
|
export default class Config extends publicConfig implements CreateComponentType {
|
||||||
|
@ -1,6 +1,69 @@
|
|||||||
<template>
|
<template>
|
||||||
|
<CollapseItem name="线条" :expanded="true">
|
||||||
|
<SettingItemBox
|
||||||
|
:name="`颜色-${index + 1}`"
|
||||||
|
v-for="(item, index) in optionData.colors"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
|
<SettingItem name="颜色">
|
||||||
|
<n-color-picker
|
||||||
|
size="small"
|
||||||
|
:modes="['hex']"
|
||||||
|
v-model:value="optionData.colors[index]"
|
||||||
|
></n-color-picker>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem>
|
||||||
|
<n-button
|
||||||
|
size="small"
|
||||||
|
@click="optionData.colors[index] = option.colors[index]"
|
||||||
|
>
|
||||||
|
恢复默认
|
||||||
|
</n-button>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
<SettingItemBox name="具体">
|
||||||
|
<SettingItem name="线条高度">
|
||||||
|
<n-input-number
|
||||||
|
size="small"
|
||||||
|
v-model:value="optionData.lineHeight"
|
||||||
|
></n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
<SettingItem name="末端长度">
|
||||||
|
<n-input-number
|
||||||
|
size="small"
|
||||||
|
v-model:value="optionData.endWidth"
|
||||||
|
></n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
</CollapseItem>
|
||||||
|
|
||||||
|
<CollapseItem name="动画" :expanded="true">
|
||||||
|
<SettingItemBox name="速度">
|
||||||
|
<SettingItem>
|
||||||
|
<n-input-number
|
||||||
|
v-model:value="optionData.dur"
|
||||||
|
size="small"
|
||||||
|
:step="0.5"
|
||||||
|
:min="0.5"
|
||||||
|
></n-input-number>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
|
</CollapseItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { PropType } from 'vue'
|
||||||
|
import {
|
||||||
|
CollapseItem,
|
||||||
|
SettingItemBox,
|
||||||
|
SettingItem
|
||||||
|
} from '@/components/ChartItemSetting/index'
|
||||||
|
import { option } from './config'
|
||||||
|
|
||||||
|
const props = defineProps({
|
||||||
|
optionData: {
|
||||||
|
type: Object as PropType<typeof option>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,24 +1,47 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<svg :width="w" :height="h">
|
||||||
装饰
|
<rect :x="rectX" :y="rectY" :width="w" :height="lineHeight" :fill="colors[0]">
|
||||||
</div>
|
<animate
|
||||||
|
attributeName="width"
|
||||||
|
from="0"
|
||||||
|
:to="w"
|
||||||
|
:dur="`${dur}s`"
|
||||||
|
calcMode="spline"
|
||||||
|
keyTimes="0;1"
|
||||||
|
keySplines=".42,0,.58,1"
|
||||||
|
repeatCount="indefinite"
|
||||||
|
/>
|
||||||
|
</rect>
|
||||||
|
|
||||||
|
<rect :x="rectX" :y="rectY" :width="endWidth" :height="lineHeight" :fill="colors[1]">
|
||||||
|
<animate
|
||||||
|
attributeName="x"
|
||||||
|
from="0"
|
||||||
|
:to="w"
|
||||||
|
:dur="`${dur}s`"
|
||||||
|
calcMode="spline"
|
||||||
|
keyTimes="0;1"
|
||||||
|
keySplines="0.42,0,0.58,1"
|
||||||
|
repeatCount="indefinite"
|
||||||
|
/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType, toRefs } from 'vue'
|
import { PropType, computed, toRefs, reactive } from 'vue'
|
||||||
import { CreateComponentType } from '@/packages/index.d'
|
import { CreateComponentType } from '@/packages/index.d'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
chartConfig: {
|
chartConfig: {
|
||||||
type: Object as PropType<CreateComponentType>,
|
type: Object as PropType<CreateComponentType>,
|
||||||
required: true
|
required: true,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const { w, h } = toRefs(props.chartConfig.attr)
|
const { w, h } = toRefs(props.chartConfig.attr)
|
||||||
|
const { colors, dur, endWidth, lineHeight } = toRefs(props.chartConfig.option)
|
||||||
|
|
||||||
|
const rectX = computed(() => 0)
|
||||||
|
const rectY = computed(() => h.value / 2)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
|
|
||||||
</style>
|
|
Loading…
Reference in New Issue
Block a user