# vue3-blog
**Repository Path**: NanChen042/vue3-blog
## Basic Information
- **Project Name**: vue3-blog
- **Description**: 主页
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-01-19
- **Last Updated**: 2024-05-27
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# vue3-blog帮助文档
### tsParticles安装
```ts
pnpm install @tsparticles/vue3
pnpm install @tsparticles/slim
```
vite.config.ts中添加
```ts
import Particles from "@tsparticles/vue3";
import { loadSlim } from "@tsparticles/slim";
createApp(App).use(Particles, {
init: async engine => {
await loadSlim(engine); // or you can load the slim version from "@tsparticles/slim" if don't need Shapes or Animations
},
});
```
在App.vue页面中使用
```html
```
效果:

## 关于打字机

```ts
pnpm install typed.js
```
#### 全局引入
```ts
import vuetyped from 'vue3typed'
createApp(App).use(vuetyped).mount('#app')
```
#### 使用
```html
```
#### 特性
Property |
Type |
Description |
Usage |
strings |
Array |
要输入的字符串 |
:strings="['Text 1', 'Text 2']" |
stringsElement |
String |
包含字符串子元素的元素的 ID |
:stringsElement="'myId'" |
typeSpeed |
Number |
输入速度(以毫秒为单位) |
:typeSpeed="50" |
startDelay |
Number |
打字前的时间以毫秒为单位 |
:startDelay="1000" |
backSpeed |
Number |
退格速度(以毫秒为单位) |
:backSpeed="10" |
smartBackspace |
Boolean |
仅退格与前一个字符串不匹配的内容 |
:smartBackspace="true" |
shuffle |
Boolean |
打乱顺序 |
:shuffle="true" |
backDelay |
Number |
退格之前的时间(以毫秒为单位) |
:backDelay="100" |
fadeOut |
Boolean |
淡出而不是退格 |
:fadeOut="true" |
fadeOutClass |
String |
淡入淡出动画的 css 类 |
:fadeOutClass="'fadeOutClass'" |
fadeOutDelay |
Number |
淡出延迟(以毫秒为单位) |
:fadeOutDelay="500" |
loop |
Boolean |
循环字符串 |
:loop="true" |
loopCount |
Number |
循环次数 |
:loopCount="3" |
showCursor |
Boolean |
显示光标 |
:showCursor="true" |
cursorChar |
String |
光标字符 |
:cursorChar="'_'" |
autoInsertCss |
Boolean |
将光标和淡出的 CSS 插入 HTML |
:autoInsertCss="true" |
attr |
String |
用于输入的属性 例如:输入占位符、值或仅 HTML 文本 |
:attr="'placeholder'" |
bindInputFocusEvents |
Boolean |
如果 el 是文本输入,则绑定到焦点和模糊 |
:bindInputFocusEvents="true" |
contentType |
String |
'html' 或 'null' 表示纯文本 |
:contentType="'html'" |
#### 事件
Event |
Description |
Usage |
onComplete |
全部输入完成 |
@onComplete="doSmth()" |
preStringTyped |
在输入每个字符串之前 |
@preStringTyped="doSmth()" |
onStringTyped |
输入每个字符串后 |
@onStringTyped="doSmth()" |
onLastStringBackspaced |
循环期间,在输入最后一个字符串之后 |
@onLastStringBackspaced="doSmth()" |
onTypingPaused |
打字已停止 |
@onTypingPaused="doSmth()" |
onTypingResumed |
停止输入后又开始输入 |
@onTypingResumed="doSmth()" |
onReset |
重置后 |
@onReset="doSmth()" |
onStop |
停止后 |
@onStop="doSmth()" |
onStart |
启动后 |
@onStart="doSmth()" |
onDestroy |
销毁后 |
@onDestroy="doSmth()" |
**注意!! 如果在部署时报以下错误(如没有可以直接跳过)**
```ts
src/main.ts(15,22): error TS7016: Could not find a declaration file for module 'vue3typed'. 'D:/Ademo/vite-southern-wind-blog/node_modules/.pnpm/vue3typed@0.1.5_typescript@5.3.3/node_modules/vue3typed/libs/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/vue3typed` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue3typed';`
```
那么在src目录下新建`types/index.d.ts`
```ts
declare module "vue3typed";
```
## 移动端自适应
可以拉到最下方查找
[Vue3+TS+Vant3+Pinia(H5端)配置教程](http://t.csdnimg.cn/B8t6Q)

因为主适配网站为pc,所以可以用下方的模板替换到`vite.config.ts`中
```ts
// 适配
css: {
postcss: {
plugins: [
postcssImport({
// 这里的rootValue就是你的设计稿大小
rootValue({ file }) {
return file.indexOf('vant') !== -1 ? 37.5 : 192;
},
propList: ['*'],
})
]
}
}
```
## GSAP复杂动画