Skip to content

Commit 05ee21c

Browse files
AndyAndy
Andy
authored and
Andy
committed
vite init
0 parents  commit 05ee21c

19 files changed

+523
-0
lines changed

Diff for: .gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
.DS_Store
12+
dist
13+
dist-ssr
14+
coverage
15+
*.local
16+
17+
/cypress/videos/
18+
/cypress/screenshots/
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?

Diff for: README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Intro-to-Vue-3-SFC
2+
3+
This template should help get you started developing with Vue 3 in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
[VSCode](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+
## Customize configuration
10+
11+
See [Vite Configuration Reference](https://vitejs.dev/config/).
12+
13+
## Project Setup
14+
15+
```sh
16+
npm install
17+
```
18+
19+
### Compile and Hot-Reload for Development
20+
21+
```sh
22+
npm run dev
23+
```
24+
25+
### Compile and Minify for Production
26+
27+
```sh
28+
npm run build
29+
```

Diff for: 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" href="/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite App</title>
8+
</head>
9+
<body>
10+
<div id="app"></div>
11+
<script type="module" src="/src/main.js"></script>
12+
</body>
13+
</html>

Diff for: package.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "intro-to-vue-3-sfc",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"dev": "vite",
6+
"build": "vite build",
7+
"preview": "vite preview --port 4173"
8+
},
9+
"dependencies": {
10+
"vue": "^3.2.37"
11+
},
12+
"devDependencies": {
13+
"@vitejs/plugin-vue": "^2.3.3",
14+
"vite": "^2.9.14"
15+
}
16+
}

Diff for: public/favicon.ico

4.19 KB
Binary file not shown.

Diff for: src/App.vue

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<script setup>
2+
import HelloWorld from './components/HelloWorld.vue'
3+
import TheWelcome from './components/TheWelcome.vue'
4+
</script>
5+
6+
<template>
7+
<header>
8+
<img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />
9+
10+
<div class="wrapper">
11+
<HelloWorld msg="You did it!" />
12+
</div>
13+
</header>
14+
15+
<main>
16+
<TheWelcome />
17+
</main>
18+
</template>
19+
20+
<style scoped>
21+
header {
22+
line-height: 1.5;
23+
}
24+
25+
.logo {
26+
display: block;
27+
margin: 0 auto 2rem;
28+
}
29+
30+
@media (min-width: 1024px) {
31+
header {
32+
display: flex;
33+
place-items: center;
34+
padding-right: calc(var(--section-gap) / 2);
35+
}
36+
37+
.logo {
38+
margin: 0 2rem 0 0;
39+
}
40+
41+
header .wrapper {
42+
display: flex;
43+
place-items: flex-start;
44+
flex-wrap: wrap;
45+
}
46+
}
47+
</style>

Diff for: src/assets/base.css

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/* color palette from <https://github.com/vuejs/theme> */
2+
:root {
3+
--vt-c-white: #ffffff;
4+
--vt-c-white-soft: #f8f8f8;
5+
--vt-c-white-mute: #f2f2f2;
6+
7+
--vt-c-black: #181818;
8+
--vt-c-black-soft: #222222;
9+
--vt-c-black-mute: #282828;
10+
11+
--vt-c-indigo: #2c3e50;
12+
13+
--vt-c-divider-light-1: rgba(60, 60, 60, 0.29);
14+
--vt-c-divider-light-2: rgba(60, 60, 60, 0.12);
15+
--vt-c-divider-dark-1: rgba(84, 84, 84, 0.65);
16+
--vt-c-divider-dark-2: rgba(84, 84, 84, 0.48);
17+
18+
--vt-c-text-light-1: var(--vt-c-indigo);
19+
--vt-c-text-light-2: rgba(60, 60, 60, 0.66);
20+
--vt-c-text-dark-1: var(--vt-c-white);
21+
--vt-c-text-dark-2: rgba(235, 235, 235, 0.64);
22+
}
23+
24+
/* semantic color variables for this project */
25+
:root {
26+
--color-background: var(--vt-c-white);
27+
--color-background-soft: var(--vt-c-white-soft);
28+
--color-background-mute: var(--vt-c-white-mute);
29+
30+
--color-border: var(--vt-c-divider-light-2);
31+
--color-border-hover: var(--vt-c-divider-light-1);
32+
33+
--color-heading: var(--vt-c-text-light-1);
34+
--color-text: var(--vt-c-text-light-1);
35+
36+
--section-gap: 160px;
37+
}
38+
39+
@media (prefers-color-scheme: dark) {
40+
:root {
41+
--color-background: var(--vt-c-black);
42+
--color-background-soft: var(--vt-c-black-soft);
43+
--color-background-mute: var(--vt-c-black-mute);
44+
45+
--color-border: var(--vt-c-divider-dark-2);
46+
--color-border-hover: var(--vt-c-divider-dark-1);
47+
48+
--color-heading: var(--vt-c-text-dark-1);
49+
--color-text: var(--vt-c-text-dark-2);
50+
}
51+
}
52+
53+
*,
54+
*::before,
55+
*::after {
56+
box-sizing: border-box;
57+
margin: 0;
58+
position: relative;
59+
font-weight: normal;
60+
}
61+
62+
body {
63+
min-height: 100vh;
64+
color: var(--color-text);
65+
background: var(--color-background);
66+
transition: color 0.5s, background-color 0.5s;
67+
line-height: 1.6;
68+
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
69+
Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
70+
font-size: 15px;
71+
text-rendering: optimizeLegibility;
72+
-webkit-font-smoothing: antialiased;
73+
-moz-osx-font-smoothing: grayscale;
74+
}

Diff for: src/assets/logo.svg

+1
Loading

Diff for: src/assets/main.css

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@import "./base.css";
2+
3+
#app {
4+
max-width: 1280px;
5+
margin: 0 auto;
6+
padding: 2rem;
7+
8+
font-weight: normal;
9+
}
10+
11+
a,
12+
.green {
13+
text-decoration: none;
14+
color: hsla(160, 100%, 37%, 1);
15+
transition: 0.4s;
16+
}
17+
18+
@media (hover: hover) {
19+
a:hover {
20+
background-color: hsla(160, 100%, 37%, 0.2);
21+
}
22+
}
23+
24+
@media (min-width: 1024px) {
25+
body {
26+
display: flex;
27+
place-items: center;
28+
}
29+
30+
#app {
31+
display: grid;
32+
grid-template-columns: 1fr 1fr;
33+
padding: 0 2rem;
34+
}
35+
}

Diff for: src/components/HelloWorld.vue

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<script setup>
2+
defineProps({
3+
msg: {
4+
type: String,
5+
required: true
6+
}
7+
})
8+
</script>
9+
10+
<template>
11+
<div class="greetings">
12+
<h1 class="green">{{ msg }}</h1>
13+
<h3>
14+
You’ve successfully created a project with
15+
<a target="_blank" href="https://vitejs.dev/">Vite</a> +
16+
<a target="_blank" href="https://vuejs.org/">Vue 3</a>.
17+
</h3>
18+
</div>
19+
</template>
20+
21+
<style scoped>
22+
h1 {
23+
font-weight: 500;
24+
font-size: 2.6rem;
25+
top: -10px;
26+
}
27+
28+
h3 {
29+
font-size: 1.2rem;
30+
}
31+
32+
.greetings h1,
33+
.greetings h3 {
34+
text-align: center;
35+
}
36+
37+
@media (min-width: 1024px) {
38+
.greetings h1,
39+
.greetings h3 {
40+
text-align: left;
41+
}
42+
}
43+
</style>

Diff for: src/components/TheWelcome.vue

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<script setup>
2+
import WelcomeItem from './WelcomeItem.vue'
3+
import DocumentationIcon from './icons/IconDocumentation.vue'
4+
import ToolingIcon from './icons/IconTooling.vue'
5+
import EcosystemIcon from './icons/IconEcosystem.vue'
6+
import CommunityIcon from './icons/IconCommunity.vue'
7+
import SupportIcon from './icons/IconSupport.vue'
8+
</script>
9+
10+
<template>
11+
<WelcomeItem>
12+
<template #icon>
13+
<DocumentationIcon />
14+
</template>
15+
<template #heading>Documentation</template>
16+
17+
Vue’s
18+
<a target="_blank" href="https://vuejs.org/">official documentation</a>
19+
provides you with all information you need to get started.
20+
</WelcomeItem>
21+
22+
<WelcomeItem>
23+
<template #icon>
24+
<ToolingIcon />
25+
</template>
26+
<template #heading>Tooling</template>
27+
28+
This project is served and bundled with
29+
<a href="https://vitejs.dev/guide/features.html" target="_blank">Vite</a>. The recommended IDE
30+
setup is <a href="https://code.visualstudio.com/" target="_blank">VSCode</a> +
31+
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>. If you need to test
32+
your components and web pages, check out
33+
<a href="https://www.cypress.io/" target="_blank">Cypress</a> and
34+
<a href="https://on.cypress.io/component" target="_blank"
35+
>Cypress Component Testing</a
36+
>.
37+
38+
<br />
39+
40+
More instructions are available in <code>README.md</code>.
41+
</WelcomeItem>
42+
43+
<WelcomeItem>
44+
<template #icon>
45+
<EcosystemIcon />
46+
</template>
47+
<template #heading>Ecosystem</template>
48+
49+
Get official tools and libraries for your project:
50+
<a target="_blank" href="https://pinia.vuejs.org/">Pinia</a>,
51+
<a target="_blank" href="https://router.vuejs.org/">Vue Router</a>,
52+
<a target="_blank" href="https://test-utils.vuejs.org/">Vue Test Utils</a>, and
53+
<a target="_blank" href="https://github.com/vuejs/devtools">Vue Dev Tools</a>. If you need more
54+
resources, we suggest paying
55+
<a target="_blank" href="https://github.com/vuejs/awesome-vue">Awesome Vue</a>
56+
a visit.
57+
</WelcomeItem>
58+
59+
<WelcomeItem>
60+
<template #icon>
61+
<CommunityIcon />
62+
</template>
63+
<template #heading>Community</template>
64+
65+
Got stuck? Ask your question on
66+
<a target="_blank" href="https://chat.vuejs.org">Vue Land</a>, our official Discord server, or
67+
<a target="_blank" href="https://stackoverflow.com/questions/tagged/vue.js">StackOverflow</a>.
68+
You should also subscribe to
69+
<a target="_blank" href="https://news.vuejs.org">our mailing list</a> and follow the official
70+
<a target="_blank" href="https://twitter.com/vuejs">@vuejs</a>
71+
twitter account for latest news in the Vue world.
72+
</WelcomeItem>
73+
74+
<WelcomeItem>
75+
<template #icon>
76+
<SupportIcon />
77+
</template>
78+
<template #heading>Support Vue</template>
79+
80+
As an independent project, Vue relies on community backing for its sustainability. You can help
81+
us by
82+
<a target="_blank" href="https://vuejs.org/sponsor/">becoming a sponsor</a>.
83+
</WelcomeItem>
84+
</template>

0 commit comments

Comments
 (0)