Skip to content

Commit 73402df

Browse files
committed
🎉 init:
0 parents  commit 73402df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+9764
-0
lines changed

.env.development

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VITE_NODE_ENV = "development"
2+
3+
VITE_APP_ENV = "development"

.env.production

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VITE_NODE_ENV = "production"
2+
3+
VITE_APP_ENV = "production"

.env.sit

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
VITE_NODE_ENV = "production"
2+
3+
VITE_APP_ENV = "sit"

.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
# .env
23+
# .env.*
24+
# !.env.example

.vscode/nuxt.code-snippets

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
// Place your nuxt-template 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
3+
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
4+
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
5+
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
6+
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
7+
// Placeholders with the same ids are connected.
8+
// Example:
9+
"Print to console: dushuai": {
10+
"scope": "javascript,typescript",
11+
"prefix": "log",
12+
"body": [
13+
"console.log('$1')"
14+
],
15+
"description": "Log output to console: dushuai"
16+
},
17+
"Print to nuxt template: dushuai": {
18+
"scope": "nuxt",
19+
"prefix": "nuxt",
20+
"body": [
21+
"<script setup lang='ts'>",
22+
"$1",
23+
"</script>",
24+
"<template>",
25+
" $TM_FILENAME_BASE",
26+
"</template>",
27+
"<style lang='scss' scoped>",
28+
"</style>",
29+
""
30+
],
31+
"description": "nuxt template: dushuai"
32+
},
33+
"Print to arrows function: dushuai": {
34+
"scope": "javascript,typescript",
35+
"prefix": "()",
36+
"body": [
37+
"() => {",
38+
"$1",
39+
"}"
40+
],
41+
"description": "arrows function: dushuai"
42+
}
43+
}

.vscode/settings.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"prettier.enable": false,
3+
"editor.codeActionsOnSave": {
4+
"source.fixAll.eslint": "explicit"
5+
},
6+
"files.associations": {
7+
"*.css": "postcss"
8+
},
9+
"editor.formatOnSave": true
10+
}

README.md

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Nuxt 3 Minimal Starter
2+
3+
Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
4+
5+
## Setup
6+
7+
Make sure to install the dependencies:
8+
9+
```bash
10+
# npm
11+
npm install
12+
13+
# pnpm
14+
pnpm install
15+
16+
# yarn
17+
yarn install
18+
19+
# bun
20+
bun install
21+
```
22+
23+
## Development Server
24+
25+
Start the development server on `http://localhost:3000`:
26+
27+
```bash
28+
# npm
29+
npm run dev
30+
31+
# pnpm
32+
pnpm run dev
33+
34+
# yarn
35+
yarn dev
36+
37+
# bun
38+
bun run dev
39+
```
40+
41+
## Production
42+
43+
Build the application for production:
44+
45+
```bash
46+
# npm
47+
npm run build
48+
49+
# pnpm
50+
pnpm run build
51+
52+
# yarn
53+
yarn build
54+
55+
# bun
56+
bun run build
57+
```
58+
59+
Locally preview production build:
60+
61+
```bash
62+
# npm
63+
npm run preview
64+
65+
# pnpm
66+
pnpm run preview
67+
68+
# yarn
69+
yarn preview
70+
71+
# bun
72+
bun run preview
73+
```
74+
75+
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.

app.vue

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!--
2+
* @Author: dushuai
3+
* @Date: 2023-12-01 14:29:58
4+
* @LastEditors: dushuai
5+
* @LastEditTime: 2023-12-10 11:52:16
6+
* @description: appvue
7+
-->
8+
<template>
9+
<div>
10+
<!-- <NuxtWelcome /> -->
11+
<NuxtLayout>
12+
<NuxtPage />
13+
</NuxtLayout>
14+
</div>
15+
</template>

index.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* @Author: dushuai
3+
* @Date: 2023-12-04 09:32:55
4+
* @LastEditors: dushuai
5+
* @LastEditTime: 2023-12-04 14:36:36
6+
* @description: d.ts
7+
*/
8+
/// <reference types="./src/types/app.d.ts" />
9+
/// <reference types="./src/types/request.d.ts" />
10+
/// <reference types="./src/types/response.d.ts" />
11+
/// <reference types="./src/types/global.d.ts" />
12+
13+
declare module "lodash-es";

nuxt.config.ts

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* @Author: dushuai
3+
* @Date: 2023-12-04 09:32:55
4+
* @LastEditors: dushuai
5+
* @LastEditTime: 2023-12-10 20:57:19
6+
* @description: nuxt.config
7+
*/
8+
import { loadEnv } from "vite";
9+
10+
/**
11+
* 环境变量引入nuxt客户端的方案 通过 useRuntimeConfig().public使用
12+
*/
13+
/**
14+
* 环境变量接口
15+
*/
16+
interface VITE_ENV_CONFIG {
17+
VITE_NODE_ENV: string;
18+
VITE_APP_ENV: string;
19+
}
20+
const envScript = (process.env as any).npm_lifecycle_script.split(" "); // 启动命令字符串
21+
const envName = envScript[envScript.length - 1]; // 当前运行环境 对应文件名
22+
const envData = loadEnv(envName, "env") as unknown as VITE_ENV_CONFIG;
23+
24+
// https://nuxt.com/docs/api/configuration/nuxt-config
25+
export default defineNuxtConfig({
26+
srcDir: "src",
27+
devtools: { enabled: true },
28+
29+
// 环境变量 public可在客户端useRuntimeConfig().public访问
30+
runtimeConfig: {
31+
public: {
32+
...envData,
33+
},
34+
},
35+
36+
// 配置modules会自动加载
37+
modules: [
38+
// pinia plugin - https://pinia.esm.dev
39+
"@pinia/nuxt",
40+
"@pinia-plugin-persistedstate/nuxt",
41+
"@nuxtjs/tailwindcss",
42+
],
43+
44+
// 配置pinia持久化 存储在session内,在store/*ts内设置无效
45+
piniaPersistedstate: {
46+
storage: "sessionStorage",
47+
},
48+
49+
// 配置tailwindcss
50+
tailwindcss: {
51+
configPath: "./tailwind.config.js",
52+
cssPath: "./src/assets/styles/tailwind.css",
53+
},
54+
55+
vite: {
56+
// envDir: "~/src/env",
57+
},
58+
59+
// css: [
60+
// '@/assets/styles/tailwind.css'
61+
// ],
62+
63+
postcss: {
64+
plugins: {
65+
"postcss-nested": {},
66+
"postcss-import": {},
67+
"tailwindcss/nesting": {},
68+
tailwindcss: {},
69+
},
70+
},
71+
72+
// 可配置插件执行时机 或 在插件文件名添加后缀 无后缀都执行 client客户端 server服务器
73+
// plugins: [{ src: "~/plugins/theme.client.js", mode: "client" }],
74+
});

package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"name": "nuxt-app",
3+
"private": true,
4+
"type": "module",
5+
"scripts": {
6+
"build": "nuxt build",
7+
"dev": "nuxt dev --dotenv .env.development",
8+
"sit": "nuxt build --dotenv .env.sit",
9+
"prod": "nuxt build --dotenv .env.production",
10+
"generate": "nuxt generate",
11+
"preview": "nuxt preview",
12+
"postinstall": "nuxt prepare"
13+
},
14+
"devDependencies": {
15+
"@nuxt/devtools": "latest",
16+
"@nuxtjs/tailwindcss": "^6.10.1",
17+
"@pinia-plugin-persistedstate/nuxt": "^1.2.0",
18+
"@pinia/nuxt": "^0.5.1",
19+
"@tailwindcss/aspect-ratio": "^0.4.2",
20+
"@tailwindcss/forms": "^0.5.7",
21+
"@tailwindcss/typography": "^0.5.10",
22+
"lodash-es": "^4.17.21",
23+
"nuxt": "^3.10.2",
24+
"pinia": "^2.1.7",
25+
"sass": "^1.69.5",
26+
"vite": "^5.0.4",
27+
"vue": "^3.4.19",
28+
"vue-router": "^4.2.5"
29+
}
30+
}

0 commit comments

Comments
 (0)