mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-22 21:46:23 +08:00
style: 调整翻牌默认大小
This commit is contained in:
parent
75b5103637
commit
48d17f9244
@ -9,11 +9,10 @@ type STYLE = '时分秒' | '冒号'
|
|||||||
|
|
||||||
export interface OptionType {
|
export interface OptionType {
|
||||||
dataset: number
|
dataset: number
|
||||||
fixedDate: boolean
|
useEndDate: boolean
|
||||||
endDate: number
|
endDate: number
|
||||||
style: STYLE
|
style: STYLE
|
||||||
showDay: boolean
|
showDay: boolean
|
||||||
flipperLength: number
|
|
||||||
flipperBgColor: string
|
flipperBgColor: string
|
||||||
flipperTextColor: string
|
flipperTextColor: string
|
||||||
flipperWidth: number
|
flipperWidth: number
|
||||||
@ -26,16 +25,15 @@ export interface OptionType {
|
|||||||
|
|
||||||
export const option: OptionType = {
|
export const option: OptionType = {
|
||||||
dataset: 10 * 60, // 10分钟
|
dataset: 10 * 60, // 10分钟
|
||||||
fixedDate: false,
|
useEndDate: false,
|
||||||
endDate: new Date().getTime(), // 当前时间
|
endDate: new Date().getTime(), // 当前时间
|
||||||
style: '时分秒',
|
style: '时分秒',
|
||||||
showDay: true,
|
showDay: false,
|
||||||
flipperLength: 6,
|
|
||||||
flipperBgColor: '#253E4E',
|
flipperBgColor: '#253E4E',
|
||||||
flipperTextColor: '#7CFFB2FF',
|
flipperTextColor: '#7CFFB2FF',
|
||||||
flipperWidth: 60,
|
flipperWidth: 30,
|
||||||
flipperHeight: 100,
|
flipperHeight: 50,
|
||||||
flipperRadius: 10,
|
flipperRadius: 5,
|
||||||
flipperGap: 10,
|
flipperGap: 10,
|
||||||
flipperType: 'down',
|
flipperType: 'down',
|
||||||
flipperSpeed: 450
|
flipperSpeed: 450
|
||||||
@ -43,7 +41,7 @@ export const option: OptionType = {
|
|||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
public key = CountDownConfig.key
|
public key = CountDownConfig.key
|
||||||
public attr = { ...chartInitConfig, w: 950, h: 160, zIndex: -1 }
|
public attr = { ...chartInitConfig, w: 500, h: 100, zIndex: -1 }
|
||||||
public chartConfig = cloneDeep(CountDownConfig)
|
public chartConfig = cloneDeep(CountDownConfig)
|
||||||
public option = cloneDeep(option)
|
public option = cloneDeep(option)
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
v-model:value="optionData.dataset"
|
v-model:value="optionData.dataset"
|
||||||
size="small"
|
size="small"
|
||||||
:min="0"
|
:min="0"
|
||||||
:disabled="optionData.fixedDate"
|
:disabled="optionData.useEndDate"
|
||||||
></n-input-number>
|
></n-input-number>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
<setting-item name="结束日期">
|
<setting-item name="结束日期">
|
||||||
<n-date-picker v-model:value="optionData.endDate" type="datetime" :disabled="!optionData.fixedDate" />
|
<n-date-picker v-model:value="optionData.endDate" type="datetime" :disabled="!optionData.useEndDate" />
|
||||||
</setting-item>
|
</setting-item>
|
||||||
<setting-item>
|
<setting-item>
|
||||||
<n-checkbox v-model:checked="optionData.fixedDate" size="small">使用固定日期</n-checkbox>
|
<n-checkbox v-model:checked="optionData.useEndDate" size="small">使用固定结束日期</n-checkbox>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
</setting-item-box>
|
</setting-item-box>
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ const { w, h } = toRefs(props.chartConfig.attr)
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
dataset,
|
dataset,
|
||||||
fixedDate,
|
useEndDate,
|
||||||
endDate,
|
endDate,
|
||||||
style,
|
style,
|
||||||
showDay,
|
showDay,
|
||||||
@ -132,7 +132,7 @@ const renderCountdown: CountdownProps['render'] = ({ hours, minutes, seconds })
|
|||||||
|
|
||||||
const updateTotalDuration = () => {
|
const updateTotalDuration = () => {
|
||||||
countdownActive.value = false
|
countdownActive.value = false
|
||||||
totalDuration.value = fixedDate.value ? endDate.value - new Date().getTime() : dataset.value * 1000
|
totalDuration.value = useEndDate.value ? endDate.value - new Date().getTime() : dataset.value * 1000
|
||||||
countdownRef.value?.reset && countdownRef.value?.reset()
|
countdownRef.value?.reset && countdownRef.value?.reset()
|
||||||
countdownActive.value = true
|
countdownActive.value = true
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
watch(
|
watch(
|
||||||
() => props.chartConfig.option.fixedDate,
|
() => props.chartConfig.option.useEndDate,
|
||||||
() => {
|
() => {
|
||||||
updateTotalDuration()
|
updateTotalDuration()
|
||||||
},
|
},
|
||||||
@ -177,5 +177,6 @@ onMounted(() => {
|
|||||||
font-size: v-bind('`${flipperWidth}px`');
|
font-size: v-bind('`${flipperWidth}px`');
|
||||||
line-height: v-bind('`${flipperHeight}px`');
|
line-height: v-bind('`${flipperHeight}px`');
|
||||||
color: v-bind('flipperTextColor');
|
color: v-bind('flipperTextColor');
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -23,9 +23,9 @@ export const option: OptionType = {
|
|||||||
flipperLength: 6,
|
flipperLength: 6,
|
||||||
flipperBgColor: '#253E4E',
|
flipperBgColor: '#253E4E',
|
||||||
flipperTextColor: '#7CFFB2FF',
|
flipperTextColor: '#7CFFB2FF',
|
||||||
flipperWidth: 60,
|
flipperWidth: 30,
|
||||||
flipperHeight: 100,
|
flipperHeight: 50,
|
||||||
flipperRadius: 10,
|
flipperRadius: 5,
|
||||||
flipperGap: 10,
|
flipperGap: 10,
|
||||||
flipperType: 'down',
|
flipperType: 'down',
|
||||||
flipperSpeed: 450
|
flipperSpeed: 450
|
||||||
@ -33,7 +33,7 @@ export const option: OptionType = {
|
|||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
public key = FlipperNumberConfig.key
|
public key = FlipperNumberConfig.key
|
||||||
public attr = { ...chartInitConfig, w: 500, h: 160, zIndex: -1 }
|
public attr = { ...chartInitConfig, w: 300, h: 100, zIndex: -1 }
|
||||||
public chartConfig = cloneDeep(FlipperNumberConfig)
|
public chartConfig = cloneDeep(FlipperNumberConfig)
|
||||||
public option = cloneDeep(option)
|
public option = cloneDeep(option)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- <n-countdown :duration="50000" :active="true" /> -->
|
<!-- <n-countdown :duration="50000" :active="true" /> -->
|
||||||
<n-space class="go-decorates-more-countdown" :size="flipperGap" align="center" justify="center">
|
<n-space class="go-decorates-flipper-number" :size="flipperGap" align="center" justify="center">
|
||||||
<flipper
|
<flipper
|
||||||
:count="item"
|
:count="item"
|
||||||
:width="flipperWidth"
|
:width="flipperWidth"
|
||||||
@ -12,6 +12,7 @@
|
|||||||
:duration="flipperSpeed"
|
:duration="flipperSpeed"
|
||||||
v-for="(item, index) in flipperData"
|
v-for="(item, index) in flipperData"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
class="go-d-block"
|
||||||
/>
|
/>
|
||||||
</n-space>
|
</n-space>
|
||||||
</template>
|
</template>
|
||||||
@ -51,7 +52,7 @@ const getFlipperData = (val: string | number) => {
|
|||||||
.toString()
|
.toString()
|
||||||
.padStart(flipperLength.value, '0') // 左侧填充|右对齐
|
.padStart(flipperLength.value, '0') // 左侧填充|右对齐
|
||||||
.split('') // 转数组
|
.split('') // 转数组
|
||||||
.slice(flipperLength.value * -1) // 从右向左取
|
.slice(flipperLength.value * -1) // 从后面取指定长度
|
||||||
}
|
}
|
||||||
const updateDatasetHandler = (newVal: string | number) => {
|
const updateDatasetHandler = (newVal: string | number) => {
|
||||||
flipperData.value = getFlipperData(newVal)
|
flipperData.value = getFlipperData(newVal)
|
||||||
@ -74,7 +75,7 @@ useChartDataFetch(props.chartConfig, useChartEditStore, (newVal: string | number
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@include go('decorates-more-countdown') {
|
@include go('decorates-flipper-number') {
|
||||||
width: v-bind('`${w}px`');
|
width: v-bind('`${w}px`');
|
||||||
height: v-bind('`${h}px`');
|
height: v-bind('`${h}px`');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user