mirror of
https://github.com/DavidHDev/vue-bits.git
synced 2026-03-07 06:29:30 -07:00
Merge pull request #65 from Gazoon007/feat/count-up-demo-customize-component
feat(CountUpDemo): integrate customize component
This commit is contained in:
@@ -6,18 +6,18 @@
|
|||||||
<div class="demo-container relative">
|
<div class="demo-container relative">
|
||||||
<CountUp
|
<CountUp
|
||||||
:key="keyDefault"
|
:key="keyDefault"
|
||||||
:from="0"
|
:from="from"
|
||||||
:to="100"
|
:to="to"
|
||||||
separator=","
|
:direction="direction"
|
||||||
direction="up"
|
:delay="delay"
|
||||||
:duration="1"
|
:duration="duration"
|
||||||
class-name="count-up-text"
|
class-name="count-up-text"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RefreshButton @click="forceRerenderDefault" />
|
<RefreshButton @click="forceRerenderDefault" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 class="demo-title-extra">Start Programatically</h2>
|
<h2 class="demo-title-extra">Start Programmatically</h2>
|
||||||
|
|
||||||
<div class="demo-container flex flex-col justify-center items-center relative min-h-[200px]">
|
<div class="demo-container flex flex-col justify-center items-center relative min-h-[200px]">
|
||||||
<button
|
<button
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<CountUp
|
<CountUp
|
||||||
:key="keyProgramatically"
|
:key="keyProgrammatically"
|
||||||
:from="100"
|
:from="100"
|
||||||
:to="500"
|
:to="500"
|
||||||
:start-when="startCounting"
|
:start-when="startCounting"
|
||||||
@@ -36,9 +36,21 @@
|
|||||||
class-name="count-up-text"
|
class-name="count-up-text"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RefreshButton v-if="startCounting" @click="forceRerenderProgramatically" />
|
<RefreshButton v-if="startCounting" @click="forceRerenderProgrammatically" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Customize>
|
||||||
|
<PreviewSlider title="From" v-model="from" :min="0" :max="100" :step="10" />
|
||||||
|
|
||||||
|
<PreviewSlider title="To" v-model="to" :min="100" :max="500" :step="100" />
|
||||||
|
|
||||||
|
<PreviewSelect title="Direction" v-model="direction" :options="directionOptions" />
|
||||||
|
|
||||||
|
<PreviewSlider title="Duration" v-model="duration" :min="0.5" :max="10" :step="0.5" value-unit="s" />
|
||||||
|
|
||||||
|
<PreviewSlider title="Delay" v-model="delay" :min="0" :max="5" :step="0.5" value-unit="s" />
|
||||||
|
</Customize>
|
||||||
|
|
||||||
<PropTable :data="propData" />
|
<PropTable :data="propData" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -62,19 +74,33 @@ import RefreshButton from '../../components/common/RefreshButton.vue';
|
|||||||
import CountUp from '../../content/Animations/CountUp/CountUp.vue';
|
import CountUp from '../../content/Animations/CountUp/CountUp.vue';
|
||||||
import { countup } from '@/constants/code/Animations/countUpCode';
|
import { countup } from '@/constants/code/Animations/countUpCode';
|
||||||
import { useForceRerender } from '@/composables/useForceRerender';
|
import { useForceRerender } from '@/composables/useForceRerender';
|
||||||
|
import Customize from '../../components/common/Customize.vue';
|
||||||
|
import PreviewSlider from '../../components/common/PreviewSlider.vue';
|
||||||
|
import PreviewSelect from '../../components/common/PreviewSelect.vue';
|
||||||
|
|
||||||
const startCounting = ref(false);
|
const startCounting = ref(false);
|
||||||
|
|
||||||
const { rerenderKey: keyDefault, forceRerender: forceRerenderDefault } = useForceRerender();
|
const { rerenderKey: keyDefault, forceRerender: forceRerenderDefault } = useForceRerender();
|
||||||
const { rerenderKey: keyProgramatically, forceRerender: forceRerenderProgramatically } = useForceRerender();
|
const { rerenderKey: keyProgrammatically, forceRerender: forceRerenderProgrammatically } = useForceRerender();
|
||||||
|
|
||||||
const setStartCounting = (value: boolean) => {
|
const setStartCounting = (value: boolean) => {
|
||||||
startCounting.value = value;
|
startCounting.value = value;
|
||||||
if (value) {
|
if (value) {
|
||||||
forceRerenderProgramatically();
|
forceRerenderProgrammatically();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const from = ref(50);
|
||||||
|
const to = ref(100);
|
||||||
|
const direction = ref<'up' | 'down'>('up');
|
||||||
|
const duration = ref(2);
|
||||||
|
const delay = ref(0);
|
||||||
|
|
||||||
|
const directionOptions = [
|
||||||
|
{ label: 'Up', value: 'up' },
|
||||||
|
{ label: 'Down', value: 'down' }
|
||||||
|
];
|
||||||
|
|
||||||
const propData = [
|
const propData = [
|
||||||
{
|
{
|
||||||
name: 'to',
|
name: 'to',
|
||||||
|
|||||||
Reference in New Issue
Block a user