Skip to content

Commit 192c942

Browse files
author
jingwenzheng
committed
feat: 完成 navigation 组件
0 parents  commit 192c942

17 files changed

+2050
-0
lines changed

.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
3+
}

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Vue 3 + TypeScript + Vite
2+
3+
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4+
5+
## Recommended IDE Setup
6+
7+
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
8+
9+
## Type Support For `.vue` Imports in TS
10+
11+
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
12+
13+
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
14+
15+
1. Disable the built-in TypeScript Extension
16+
1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17+
2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18+
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.

index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + Vue + TS</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.ts"></script>
12+
</body>
13+
</html>

package.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "navigation",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "vue-tsc && vite build",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"animejs": "^3.2.1",
13+
"vue": "^3.2.45"
14+
},
15+
"devDependencies": {
16+
"@types/animejs": "^3.1.6",
17+
"@vitejs/plugin-vue": "^4.0.0",
18+
"@vitejs/plugin-vue-jsx": "^3.0.0",
19+
"typescript": "^4.9.3",
20+
"vite": "^4.0.0",
21+
"vue-tsc": "^1.0.11"
22+
}
23+
}

pnpm-lock.yaml

+1,382
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/vite.svg

+1
Loading

src/App.vue

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script setup lang="ts">
2+
const posts = [
3+
{ id: 1 },
4+
{ id: 2 },
5+
{ id: 3 },
6+
{ id: 4 },
7+
{ id: 5 },
8+
{ id: 6 },
9+
];
10+
</script>
11+
12+
<template>
13+
<div class="body">
14+
<div class="cover">
15+
<h2>Cover</h2>
16+
</div>
17+
<div class="line" v-for="i in posts" :key="i.id">
18+
<span>标题 {{ i }}</span>
19+
</div>
20+
</div>
21+
</template>
22+
23+
<style scoped>
24+
.body {
25+
display: flex;
26+
flex-direction: column;
27+
}
28+
29+
.cover {
30+
height: 200px;
31+
background: red;
32+
}
33+
34+
.line {
35+
display: flex;
36+
37+
padding: 10px 20px;
38+
border-bottom: 1px solid lightblue;
39+
}
40+
</style>

src/assets/vue.svg

+1
Loading

0 commit comments

Comments
 (0)