forked from FoundKeyGang/FoundKey
client: refactor components/ripple.vue to composition API
This commit is contained in:
parent
f571f61c2d
commit
be19ea610f
1 changed files with 35 additions and 47 deletions
|
@ -56,28 +56,23 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent, onMounted } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = withDefaults(defineProps<{
|
||||||
props: {
|
x: number;
|
||||||
x: {
|
y: number;
|
||||||
type: Number,
|
particle?: boolean;
|
||||||
required: true,
|
}>(), {
|
||||||
},
|
particle: true,
|
||||||
y: {
|
});
|
||||||
type: Number,
|
|
||||||
required: true,
|
const emit = defineEmits<{
|
||||||
},
|
(ev: 'end'): void;
|
||||||
particle: {
|
}>();
|
||||||
type: Boolean,
|
|
||||||
required: false,
|
const zIndex = os.claimZIndex('high');
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
emits: ['end'],
|
|
||||||
setup(props, context) {
|
|
||||||
const particles = [];
|
const particles = [];
|
||||||
const origin = 64;
|
const origin = 64;
|
||||||
const colors = ['#FF1493', '#00FFFF', '#FFE202'];
|
const colors = ['#FF1493', '#00FFFF', '#FFE202'];
|
||||||
|
@ -100,16 +95,9 @@ export default defineComponent({
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
context.emit('end');
|
emit('end');
|
||||||
}, 1100);
|
}, 1100);
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
|
||||||
particles,
|
|
||||||
zIndex: os.claimZIndex('high'),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in a new issue