feat:增加撒花动画
This commit is contained in:
14
docs/.vitepress/theme/components/Confetti.vue
Normal file
14
docs/.vitepress/theme/components/Confetti.vue
Normal file
@@ -0,0 +1,14 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import confetti from "canvas-confetti";
|
||||
|
||||
/* 纸屑 */
|
||||
confetti({
|
||||
particleCount: 100,
|
||||
spread: 170,
|
||||
origin: { y: 0.6 },
|
||||
});
|
||||
</script>
|
||||
@@ -1,27 +0,0 @@
|
||||
<template>
|
||||
<div class="custom-component">
|
||||
<h3>{{ title }}</h3>
|
||||
<p>{{ description }}</p>
|
||||
<button @click="count++">点击次数: {{ count }}</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
description: String
|
||||
})
|
||||
|
||||
const count = ref(0)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.custom-component {
|
||||
border: 1px solid #e2e2e2;
|
||||
padding: 1rem;
|
||||
border-radius: 8px;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,13 +1,13 @@
|
||||
import DefaultTheme from 'vitepress/theme'
|
||||
import Confetti from "./components/Confetti.vue";
|
||||
import type { EnhanceAppContext } from 'vitepress'
|
||||
|
||||
import '../theme/style.css'
|
||||
import './style/var.css'
|
||||
|
||||
// 定义组件导入的类型
|
||||
interface ComponentModule {
|
||||
default: any
|
||||
}
|
||||
|
||||
export default {
|
||||
extends: DefaultTheme
|
||||
}
|
||||
extends: DefaultTheme,
|
||||
enhanceApp({ app }: EnhanceAppContext) {
|
||||
app.component("Confetti", Confetti);
|
||||
},
|
||||
};
|
||||
|
||||
16
docs/.vitepress/tsconfig.json
Normal file
16
docs/.vitepress/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"lib": ["ES2017", "DOM"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": ["**/*.ts", "**/*.vue"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user