lins-vue3-base 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitignore ADDED
@@ -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?
package/.npmignore ADDED
@@ -0,0 +1,37 @@
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-ssr
12
+ *.local
13
+
14
+ # Editor directories and files
15
+ .vscode/*
16
+ !.vscode/extensions.json
17
+ .idea
18
+ .DS_Store
19
+ *.suo
20
+ *.ntvs*
21
+ *.njsproj
22
+ *.sln
23
+ *.sw?
24
+
25
+ # Build artifacts
26
+ node_modules/
27
+
28
+ # Environment variables
29
+ .env
30
+ .env.local
31
+ .env.*.local
32
+
33
+ # Test files
34
+ __tests__/
35
+ test/
36
+ *.spec.*
37
+ *.test.*
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "tabWidth": 4,
3
+ "useTabs": false,
4
+ "singleQuote": false,
5
+ "semi": true,
6
+ "trailingComma": "es5",
7
+ "bracketSpacing": true,
8
+ "jsxBracketSameLine": false,
9
+ "arrowParens": "avoid"
10
+ }
package/README.md ADDED
@@ -0,0 +1,5 @@
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
+ Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
@@ -0,0 +1,58 @@
1
+ import typescriptParser from "@typescript-eslint/parser";
2
+ import vueParser from "vue-eslint-parser";
3
+ import vuePlugin from "eslint-plugin-vue";
4
+ import jsoncParser from "jsonc-eslint-parser";
5
+
6
+ export default [
7
+ {
8
+ files: ["**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}"],
9
+ ignores: ["**/node_modules/**", "**/dist/**"],
10
+ languageOptions: {
11
+ parser: typescriptParser,
12
+ parserOptions: {
13
+ ecmaVersion: "latest",
14
+ sourceType: "module",
15
+ },
16
+ },
17
+ rules: {
18
+ indent: ["error", 4],
19
+ },
20
+ },
21
+ {
22
+ files: ["**/*.vue"],
23
+ ignores: ["**/node_modules/**", "**/dist/**"],
24
+ languageOptions: {
25
+ parser: vueParser,
26
+ parserOptions: {
27
+ ecmaVersion: "latest",
28
+ sourceType: "module",
29
+ parser: "@typescript-eslint/parser",
30
+ },
31
+ },
32
+ plugins: {
33
+ vue: vuePlugin,
34
+ },
35
+ rules: {
36
+ indent: ["error", 4],
37
+ "vue/script-indent": [
38
+ "error",
39
+ 4,
40
+ {
41
+ baseIndent: 0,
42
+ switchCase: 1,
43
+ ignores: [],
44
+ },
45
+ ],
46
+ },
47
+ },
48
+ {
49
+ files: ["**/*.json"],
50
+ ignores: ["**/node_modules/**", "**/dist/**"],
51
+ languageOptions: {
52
+ parser: jsoncParser,
53
+ },
54
+ rules: {
55
+ indent: ["error", 4],
56
+ },
57
+ },
58
+ ];
package/index.html ADDED
@@ -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>vue3-base</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "lins-vue3-base",
3
+ "author": "Lins",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://gitee.com/linjunbin0101/base-vue.git"
8
+ },
9
+ "bugs": {
10
+ "url": "https://gitee.com/linjunbin0101/base-vue/issues"
11
+ },
12
+ "private": false,
13
+ "version": "1.0.0",
14
+ "description": "A Vue3 base project with Ant Design Vue, Axios, Pinia, Vue Router, and SCSS",
15
+ "main": "src/main.ts",
16
+ "types": "src/main.ts",
17
+ "type": "module",
18
+ "files": [
19
+ "src",
20
+ "public",
21
+ "package.json",
22
+ "README.md",
23
+ "index.html",
24
+ ".gitignore",
25
+ ".npmignore",
26
+ ".prettierrc",
27
+ "eslint.config.js",
28
+ "vite.config.ts",
29
+ "tsconfig.json",
30
+ "tsconfig.app.json",
31
+ "tsconfig.node.json",
32
+ "tailwind.config.js",
33
+ "postcss.config.js"
34
+ ],
35
+ "scripts": {
36
+ "dev": "vite",
37
+ "build": "vue-tsc -b && vite build",
38
+ "preview": "vite preview",
39
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.json",
40
+ "format": "prettier --write \"**/*.{js,jsx,cjs,mjs,ts,tsx,cts,mts,vue,json}\""
41
+ },
42
+ "dependencies": {
43
+ "ant-design-vue": "^4.2.6",
44
+ "axios": "^1.13.3",
45
+ "pinia": "^3.0.4",
46
+ "reset-css": "^5.0.2",
47
+ "vue": "^3.5.24",
48
+ "vue-router": "^4.6.4"
49
+ },
50
+ "devDependencies": {
51
+ "@eslint/js": "^9.39.2",
52
+ "@types/node": "^24.10.1",
53
+ "@typescript-eslint/eslint-plugin": "^8.53.1",
54
+ "@typescript-eslint/parser": "^8.53.1",
55
+ "@vitejs/plugin-vue": "^6.0.1",
56
+ "@vue/eslint-config-typescript": "^14.6.0",
57
+ "@vue/tsconfig": "^0.8.1",
58
+ "autoprefixer": "^10.4.23",
59
+ "eslint": "^9.39.2",
60
+ "eslint-plugin-vue": "^10.7.0",
61
+ "jsonc-eslint-parser": "^2.4.2",
62
+ "postcss": "^8.5.6",
63
+ "prettier": "^3.8.1",
64
+ "sass-embedded": "^1.97.3",
65
+ "tailwindcss": "^3.4.19",
66
+ "typescript": "~5.9.3",
67
+ "vite": "npm:rolldown-vite@7.2.5",
68
+ "vue-eslint-parser": "^10.2.0",
69
+ "vue-tsc": "^3.1.4"
70
+ },
71
+ "overrides": {
72
+ "vite": "npm:rolldown-vite@7.2.5"
73
+ },
74
+ "keywords": [
75
+ "vue3",
76
+ "base",
77
+ "ant-design-vue",
78
+ "axios",
79
+ "pinia",
80
+ "vue-router",
81
+ "scss",
82
+ "base"
83
+ ]
84
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/src/App.vue ADDED
@@ -0,0 +1,10 @@
1
+ <script setup lang="ts">
2
+ import Counter from "@/components/Counter.vue";
3
+ </script>
4
+
5
+ <template>
6
+ 123
7
+ <Counter />
8
+ </template>
9
+
10
+ <style></style>
@@ -0,0 +1,37 @@
1
+ import axios from "axios";
2
+
3
+ const instance = axios.create({
4
+ baseURL: import.meta.env.VITE_API_BASE_URL || "/api",
5
+ timeout: 10000,
6
+ headers: {
7
+ "Content-Type": "application/json",
8
+ },
9
+ });
10
+
11
+ instance.interceptors.request.use(
12
+ config => {
13
+ const token = localStorage.getItem("token");
14
+ if (token) {
15
+ config.headers.Authorization = `Bearer ${token}`;
16
+ }
17
+ return config;
18
+ },
19
+ error => {
20
+ return Promise.reject(error);
21
+ }
22
+ );
23
+
24
+ instance.interceptors.response.use(
25
+ response => {
26
+ return response;
27
+ },
28
+ error => {
29
+ if (error.response?.status === 401) {
30
+ localStorage.removeItem("token");
31
+ window.location.href = "/login";
32
+ }
33
+ return Promise.reject(error);
34
+ }
35
+ );
36
+
37
+ export default instance;
@@ -0,0 +1,7 @@
1
+ import axios from "./axios";
2
+ import userApi from "./user";
3
+ import type { User, CreateUserRequest, UpdateUserRequest } from "./user";
4
+
5
+ export { axios, userApi };
6
+
7
+ export type { User, CreateUserRequest, UpdateUserRequest };
@@ -0,0 +1,41 @@
1
+ import axios from "./axios";
2
+
3
+ export interface User {
4
+ id: number;
5
+ name: string;
6
+ email: string;
7
+ }
8
+
9
+ export interface CreateUserRequest {
10
+ name: string;
11
+ email: string;
12
+ }
13
+
14
+ export interface UpdateUserRequest {
15
+ name?: string;
16
+ email?: string;
17
+ }
18
+
19
+ const userApi = {
20
+ getUsers: (): Promise<User[]> => {
21
+ return axios.get("/users").then(response => response.data);
22
+ },
23
+
24
+ getUser: (id: number): Promise<User> => {
25
+ return axios.get(`/users/${id}`).then(response => response.data);
26
+ },
27
+
28
+ createUser: (user: CreateUserRequest): Promise<User> => {
29
+ return axios.post("/users", user).then(response => response.data);
30
+ },
31
+
32
+ updateUser: (id: number, user: UpdateUserRequest): Promise<User> => {
33
+ return axios.put(`/users/${id}`, user).then(response => response.data);
34
+ },
35
+
36
+ deleteUser: (id: number): Promise<void> => {
37
+ return axios.delete(`/users/${id}`).then(response => response.data);
38
+ },
39
+ };
40
+
41
+ export default userApi;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
@@ -0,0 +1,24 @@
1
+ <script setup lang="ts">
2
+ import { useCounterStore } from "../store";
3
+
4
+ const store = useCounterStore();
5
+ </script>
6
+
7
+ <template>
8
+ <div class="counter">
9
+ <h2>Counter Component</h2>
10
+ <a-button type="primary" @click="store.increment">
11
+ Count: {{ store.count }}
12
+ </a-button>
13
+ <p>Double count: {{ store.doubleCount }}</p>
14
+ </div>
15
+ </template>
16
+
17
+ <style scoped>
18
+ .counter {
19
+ margin: 2rem 0;
20
+ padding: 1rem;
21
+ border: 1px solid #e8e8e8;
22
+ border-radius: 8px;
23
+ }
24
+ </style>
@@ -0,0 +1 @@
1
+ declare module "reset-css";
package/src/main.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { createApp } from "vue";
2
+ import { createPinia } from "pinia";
3
+ import router from "@/router";
4
+ import "reset-css";
5
+ import Antd from "ant-design-vue";
6
+ import "ant-design-vue/dist/reset.css";
7
+ import "@/style.scss";
8
+ import App from "@/App.vue";
9
+
10
+ const app = createApp(App);
11
+ app.use(createPinia());
12
+ app.use(router);
13
+ app.use(Antd);
14
+ app.mount("#app");
@@ -0,0 +1,21 @@
1
+ import { createRouter, createWebHistory } from "vue-router";
2
+ import App from "../App.vue";
3
+ import Counter from "../components/Counter.vue";
4
+
5
+ const router = createRouter({
6
+ history: createWebHistory(),
7
+ routes: [
8
+ {
9
+ path: "/",
10
+ name: "home",
11
+ component: App,
12
+ },
13
+ {
14
+ path: "/counter",
15
+ name: "counter",
16
+ component: Counter,
17
+ },
18
+ ],
19
+ });
20
+
21
+ export default router;
@@ -0,0 +1,15 @@
1
+ import { defineStore } from "pinia";
2
+
3
+ export const useCounterStore = defineStore("counter", {
4
+ state: () => ({
5
+ count: 0,
6
+ }),
7
+ getters: {
8
+ doubleCount: state => state.count * 2,
9
+ },
10
+ actions: {
11
+ increment() {
12
+ this.count++;
13
+ },
14
+ },
15
+ });
@@ -0,0 +1,3 @@
1
+ import { useCounterStore } from "./counter";
2
+
3
+ export { useCounterStore };
package/src/style.scss ADDED
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,8 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ export default {
3
+ content: ["./index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
4
+ theme: {
5
+ extend: {},
6
+ },
7
+ plugins: [],
8
+ };
@@ -0,0 +1,22 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.dom.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
5
+ "types": ["vite/client"],
6
+
7
+ /* Path mapping */
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "@/*": ["./src/*"]
11
+ },
12
+
13
+ /* Linting */
14
+ "strict": true,
15
+ "noUnusedLocals": true,
16
+ "noUnusedParameters": true,
17
+ "erasableSyntaxOnly": true,
18
+ "noFallthroughCasesInSwitch": true,
19
+ "noUncheckedSideEffectImports": true
20
+ },
21
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"]
22
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "module": "ESNext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "erasableSyntaxOnly": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "noUncheckedSideEffectImports": true
24
+ },
25
+ "include": ["vite.config.ts"]
26
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,36 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import { resolve } from 'path'
4
+
5
+ // https://vitejs.dev/config/
6
+ export default defineConfig({
7
+ plugins: [vue()],
8
+ server: {
9
+ port: 1126
10
+ },
11
+ resolve: {
12
+ alias: {
13
+ '@': resolve(__dirname, 'src')
14
+ }
15
+ },
16
+ build: {
17
+ chunkSizeWarningLimit: 1500, // Increase warning limit to accommodate Ant Design Vue
18
+ rollupOptions: {
19
+ output: {
20
+ manualChunks(id) {
21
+ if (id.includes('node_modules')) {
22
+ if (id.includes('ant-design-vue')) {
23
+ return 'ant-design'
24
+ }
25
+ if (id.includes('axios')) {
26
+ return 'axios'
27
+ }
28
+ if (id.includes('vue') || id.includes('pinia') || id.includes('vue-router')) {
29
+ return 'vue-core'
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ });