From be5beea29f2b2dc7e91cadf8afb3457d560cc2f5 Mon Sep 17 00:00:00 2001 From: XiaoHH Date: Mon, 1 Dec 2025 21:47:40 +0800 Subject: [PATCH] init --- .gitattributes | 4 + .gitignore | 40 ++++++ pom.xml | 158 +++++++++++++++++++++ .../java/work/xiaohh/vue/XiaohhVueApplication.java | 13 ++ .../xiaohh/vue/controller/FrontEndController.java | 31 ++++ src/main/resources/application.yaml | 21 +++ src/main/webapp/.editorconfig | 8 ++ src/main/webapp/.prettierrc.json | 6 + src/main/webapp/README.md | 48 +++++++ src/main/webapp/env.d.ts | 1 + src/main/webapp/eslint.config.ts | 22 +++ src/main/webapp/index.html | 13 ++ src/main/webapp/package.json | 42 ++++++ src/main/webapp/public/favicon.ico | Bin 0 -> 4286 bytes src/main/webapp/src/App.vue | 85 +++++++++++ src/main/webapp/src/assets/base.css | 86 +++++++++++ src/main/webapp/src/assets/logo.svg | 1 + src/main/webapp/src/assets/main.css | 35 +++++ src/main/webapp/src/components/HelloWorld.vue | 41 ++++++ src/main/webapp/src/components/TheWelcome.vue | 95 +++++++++++++ src/main/webapp/src/components/WelcomeItem.vue | 87 ++++++++++++ .../webapp/src/components/icons/IconCommunity.vue | 7 + .../src/components/icons/IconDocumentation.vue | 7 + .../webapp/src/components/icons/IconEcosystem.vue | 7 + .../webapp/src/components/icons/IconSupport.vue | 7 + .../webapp/src/components/icons/IconTooling.vue | 19 +++ src/main/webapp/src/main.ts | 14 ++ src/main/webapp/src/router/index.ts | 23 +++ src/main/webapp/src/stores/counter.ts | 12 ++ src/main/webapp/src/views/AboutView.vue | 15 ++ src/main/webapp/src/views/HomeView.vue | 9 ++ src/main/webapp/tsconfig.app.json | 12 ++ src/main/webapp/tsconfig.json | 11 ++ src/main/webapp/tsconfig.node.json | 19 +++ src/main/webapp/vite.config.ts | 18 +++ .../work/xiaohh/vue/XiaohhVueApplicationTests.java | 13 ++ 36 files changed, 1030 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/work/xiaohh/vue/XiaohhVueApplication.java create mode 100644 src/main/java/work/xiaohh/vue/controller/FrontEndController.java create mode 100644 src/main/resources/application.yaml create mode 100644 src/main/webapp/.editorconfig create mode 100644 src/main/webapp/.prettierrc.json create mode 100644 src/main/webapp/README.md create mode 100644 src/main/webapp/env.d.ts create mode 100644 src/main/webapp/eslint.config.ts create mode 100644 src/main/webapp/index.html create mode 100644 src/main/webapp/package.json create mode 100644 src/main/webapp/public/favicon.ico create mode 100644 src/main/webapp/src/App.vue create mode 100644 src/main/webapp/src/assets/base.css create mode 100644 src/main/webapp/src/assets/logo.svg create mode 100644 src/main/webapp/src/assets/main.css create mode 100644 src/main/webapp/src/components/HelloWorld.vue create mode 100644 src/main/webapp/src/components/TheWelcome.vue create mode 100644 src/main/webapp/src/components/WelcomeItem.vue create mode 100644 src/main/webapp/src/components/icons/IconCommunity.vue create mode 100644 src/main/webapp/src/components/icons/IconDocumentation.vue create mode 100644 src/main/webapp/src/components/icons/IconEcosystem.vue create mode 100644 src/main/webapp/src/components/icons/IconSupport.vue create mode 100644 src/main/webapp/src/components/icons/IconTooling.vue create mode 100644 src/main/webapp/src/main.ts create mode 100644 src/main/webapp/src/router/index.ts create mode 100644 src/main/webapp/src/stores/counter.ts create mode 100644 src/main/webapp/src/views/AboutView.vue create mode 100644 src/main/webapp/src/views/HomeView.vue create mode 100644 src/main/webapp/tsconfig.app.json create mode 100644 src/main/webapp/tsconfig.json create mode 100644 src/main/webapp/tsconfig.node.json create mode 100644 src/main/webapp/vite.config.ts create mode 100644 src/test/java/work/xiaohh/vue/XiaohhVueApplicationTests.java diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c02ab27 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +* text=auto eol=lf +/mvnw text eol=lf +*.cmd text eol=crlf +*.bat text eol=crlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e89aeb --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +HELP.md +target/ +.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ +.DS_Store + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### nodejs ### +/src/main/webapp/dist +/src/main/webapp/node_modules +/src/main/resources/static +/src/main/webapp/package-lock.json diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..da24d9f --- /dev/null +++ b/pom.xml @@ -0,0 +1,158 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.5.8 + + + work.xiaohh + xiaohh-vue + 0.0.1-SNAPSHOT + xiaohh-vue + Demo project for Spring Boot + + + + + + + + + + + + + + + 17 + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-web + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 3.0.5 + + + + com.mysql + mysql-connector-j + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + org.mybatis.spring.boot + mybatis-spring-boot-starter-test + 3.0.5 + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.codehaus.mojo + exec-maven-plugin + + + + npm-install + prepare-package + + exec + + + npm + + install + + ${basedir}/src/main/webapp + + + + + npm-build + prepare-package + + exec + + + npm + + run + build + + ${basedir}/src/main/webapp + + + + + + org.apache.maven.plugins + maven-resources-plugin + + + copy-vue-dist + prepare-package + + copy-resources + + + ${basedir}/src/main/resources/static + + + ${basedir}/src/main/webapp/dist + + + + + + + + org.apache.maven.plugins + maven-clean-plugin + + + + + src/main/resources/static + + **/* + + + + + src/main/webapp/dist + + **/* + + + + + + + + + diff --git a/src/main/java/work/xiaohh/vue/XiaohhVueApplication.java b/src/main/java/work/xiaohh/vue/XiaohhVueApplication.java new file mode 100644 index 0000000..8c62202 --- /dev/null +++ b/src/main/java/work/xiaohh/vue/XiaohhVueApplication.java @@ -0,0 +1,13 @@ +package work.xiaohh.vue; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class XiaohhVueApplication { + + public static void main(String[] args) { + SpringApplication.run(XiaohhVueApplication.class, args); + } + +} diff --git a/src/main/java/work/xiaohh/vue/controller/FrontEndController.java b/src/main/java/work/xiaohh/vue/controller/FrontEndController.java new file mode 100644 index 0000000..7e7548b --- /dev/null +++ b/src/main/java/work/xiaohh/vue/controller/FrontEndController.java @@ -0,0 +1,31 @@ +package work.xiaohh.vue.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +/** + *

+ * 前段 Vue 应用控制器 + *

+ * + * @author XiaoHH + * @version 1.0.0 + */ +@Controller +public class FrontEndController { + + private static final Logger log = LoggerFactory.getLogger(FrontEndController.class); + + /** + * 访问前段 Vue 路由的控制器, + */ + @GetMapping("/**/{path:[^.]*}") + public String vueApp(@PathVariable String path) { + log.debug("访问前段路径:{}", path); + // 直接响应 index.html 单页面应用首页 + return "forward:/index.html"; + } +} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml new file mode 100644 index 0000000..d7f6166 --- /dev/null +++ b/src/main/resources/application.yaml @@ -0,0 +1,21 @@ +server: + port: 8888 + +spring: + application: + name: xiaohh-vue + web: + resources: + static-locations: + - classpath:/static/ + mvc: + static-path-pattern: /** + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/xiaohh_vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + username: root + password: xiaohh1234 + data: + redis: + host: localhost + database: 1 diff --git a/src/main/webapp/.editorconfig b/src/main/webapp/.editorconfig new file mode 100644 index 0000000..3b510aa --- /dev/null +++ b/src/main/webapp/.editorconfig @@ -0,0 +1,8 @@ +[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}] +charset = utf-8 +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +end_of_line = lf +max_line_length = 100 diff --git a/src/main/webapp/.prettierrc.json b/src/main/webapp/.prettierrc.json new file mode 100644 index 0000000..29a2402 --- /dev/null +++ b/src/main/webapp/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://json.schemastore.org/prettierrc", + "semi": false, + "singleQuote": true, + "printWidth": 100 +} diff --git a/src/main/webapp/README.md b/src/main/webapp/README.md new file mode 100644 index 0000000..0807be7 --- /dev/null +++ b/src/main/webapp/README.md @@ -0,0 +1,48 @@ +# webapp + +This template should help get you started developing with Vue 3 in Vite. + +## Recommended IDE Setup + +[VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). + +## Recommended Browser Setup + +- Chromium-based browsers (Chrome, Edge, Brave, etc.): + - [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd) + - [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters) +- Firefox: + - [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/) + - [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/) + +## Type Support for `.vue` Imports in TS + +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 [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types. + +## Customize configuration + +See [Vite Configuration Reference](https://vite.dev/config/). + +## Project Setup + +```sh +npm install +``` + +### Compile and Hot-Reload for Development + +```sh +npm run dev +``` + +### Type-Check, Compile and Minify for Production + +```sh +npm run build +``` + +### Lint with [ESLint](https://eslint.org/) + +```sh +npm run lint +``` diff --git a/src/main/webapp/env.d.ts b/src/main/webapp/env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/src/main/webapp/env.d.ts @@ -0,0 +1 @@ +/// diff --git a/src/main/webapp/eslint.config.ts b/src/main/webapp/eslint.config.ts new file mode 100644 index 0000000..20475f8 --- /dev/null +++ b/src/main/webapp/eslint.config.ts @@ -0,0 +1,22 @@ +import { globalIgnores } from 'eslint/config' +import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript' +import pluginVue from 'eslint-plugin-vue' +import skipFormatting from '@vue/eslint-config-prettier/skip-formatting' + +// To allow more languages other than `ts` in `.vue` files, uncomment the following lines: +// import { configureVueProject } from '@vue/eslint-config-typescript' +// configureVueProject({ scriptLangs: ['ts', 'tsx'] }) +// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup + +export default defineConfigWithVueTs( + { + name: 'app/files-to-lint', + files: ['**/*.{ts,mts,tsx,vue}'], + }, + + globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']), + + pluginVue.configs['flat/essential'], + vueTsConfigs.recommended, + skipFormatting, +) diff --git a/src/main/webapp/index.html b/src/main/webapp/index.html new file mode 100644 index 0000000..9e5fc8f --- /dev/null +++ b/src/main/webapp/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite App + + +
+ + + diff --git a/src/main/webapp/package.json b/src/main/webapp/package.json new file mode 100644 index 0000000..9c88884 --- /dev/null +++ b/src/main/webapp/package.json @@ -0,0 +1,42 @@ +{ + "name": "webapp", + "version": "0.0.0", + "private": true, + "type": "module", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "scripts": { + "dev": "vite", + "build": "run-p type-check \"build-only {@}\" --", + "preview": "vite preview", + "build-only": "vite build", + "type-check": "vue-tsc --build", + "lint": "eslint . --fix --cache", + "format": "prettier --write --experimental-cli src/" + }, + "dependencies": { + "axios": "^1.13.2", + "element-plus": "^2.11.9", + "pinia": "^3.0.4", + "vue": "^3.5.25", + "vue-router": "^4.6.3" + }, + "devDependencies": { + "@tsconfig/node24": "^24.0.3", + "@types/node": "^24.10.1", + "@vitejs/plugin-vue": "^6.0.2", + "@vue/eslint-config-prettier": "^10.2.0", + "@vue/eslint-config-typescript": "^14.6.0", + "@vue/tsconfig": "^0.8.1", + "eslint": "^9.39.1", + "eslint-plugin-vue": "~10.5.1", + "jiti": "^2.6.1", + "npm-run-all2": "^8.0.4", + "prettier": "3.6.2", + "typescript": "~5.9.0", + "vite": "^7.2.4", + "vite-plugin-vue-devtools": "^8.0.5", + "vue-tsc": "^3.1.5" + } +} diff --git a/src/main/webapp/public/favicon.ico b/src/main/webapp/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..df36fcfb72584e00488330b560ebcf34a41c64c2 GIT binary patch literal 4286 zcmds*O-Phc6o&64GDVCEQHxsW(p4>LW*W<827=Unuo8sGpRux(DN@jWP-e29Wl%wj zY84_aq9}^Am9-cWTD5GGEo#+5Fi2wX_P*bo+xO!)p*7B;iKlbFd(U~_d(U?#hLj56 zPhFkj-|A6~Qk#@g^#D^U0XT1cu=c-vu1+SElX9NR;kzAUV(q0|dl0|%h|dI$%VICy zJnu2^L*Te9JrJMGh%-P79CL0}dq92RGU6gI{v2~|)p}sG5x0U*z<8U;Ij*hB9z?ei z@g6Xq-pDoPl=MANPiR7%172VA%r)kevtV-_5H*QJKFmd;8yA$98zCxBZYXTNZ#QFk2(TX0;Y2dt&WitL#$96|gJY=3xX zpCoi|YNzgO3R`f@IiEeSmKrPSf#h#Qd<$%Ej^RIeeYfsxhPMOG`S`Pz8q``=511zm zAm)MX5AV^5xIWPyEu7u>qYs?pn$I4nL9J!=K=SGlKLXpE<5x+2cDTXq?brj?n6sp= zphe9;_JHf40^9~}9i08r{XM$7HB!`{Ys~TK0kx<}ZQng`UPvH*11|q7&l9?@FQz;8 zx!=3<4seY*%=OlbCbcae?5^V_}*K>Uo6ZWV8mTyE^B=DKy7-sdLYkR5Z?paTgK-zyIkKjIcpyO z{+uIt&YSa_$QnN_@t~L014dyK(fOOo+W*MIxbA6Ndgr=Y!f#Tokqv}n<7-9qfHkc3 z=>a|HWqcX8fzQCT=dqVbogRq!-S>H%yA{1w#2Pn;=e>JiEj7Hl;zdt-2f+j2%DeVD zsW0Ab)ZK@0cIW%W7z}H{&~yGhn~D;aiP4=;m-HCo`BEI+Kd6 z={Xwx{TKxD#iCLfl2vQGDitKtN>z|-AdCN|$jTFDg0m3O`WLD4_s#$S literal 0 HcmV?d00001 diff --git a/src/main/webapp/src/App.vue b/src/main/webapp/src/App.vue new file mode 100644 index 0000000..7905b05 --- /dev/null +++ b/src/main/webapp/src/App.vue @@ -0,0 +1,85 @@ + + + + + diff --git a/src/main/webapp/src/assets/base.css b/src/main/webapp/src/assets/base.css new file mode 100644 index 0000000..8816868 --- /dev/null +++ b/src/main/webapp/src/assets/base.css @@ -0,0 +1,86 @@ +/* color palette from */ +:root { + --vt-c-white: #ffffff; + --vt-c-white-soft: #f8f8f8; + --vt-c-white-mute: #f2f2f2; + + --vt-c-black: #181818; + --vt-c-black-soft: #222222; + --vt-c-black-mute: #282828; + + --vt-c-indigo: #2c3e50; + + --vt-c-divider-light-1: rgba(60, 60, 60, 0.29); + --vt-c-divider-light-2: rgba(60, 60, 60, 0.12); + --vt-c-divider-dark-1: rgba(84, 84, 84, 0.65); + --vt-c-divider-dark-2: rgba(84, 84, 84, 0.48); + + --vt-c-text-light-1: var(--vt-c-indigo); + --vt-c-text-light-2: rgba(60, 60, 60, 0.66); + --vt-c-text-dark-1: var(--vt-c-white); + --vt-c-text-dark-2: rgba(235, 235, 235, 0.64); +} + +/* semantic color variables for this project */ +:root { + --color-background: var(--vt-c-white); + --color-background-soft: var(--vt-c-white-soft); + --color-background-mute: var(--vt-c-white-mute); + + --color-border: var(--vt-c-divider-light-2); + --color-border-hover: var(--vt-c-divider-light-1); + + --color-heading: var(--vt-c-text-light-1); + --color-text: var(--vt-c-text-light-1); + + --section-gap: 160px; +} + +@media (prefers-color-scheme: dark) { + :root { + --color-background: var(--vt-c-black); + --color-background-soft: var(--vt-c-black-soft); + --color-background-mute: var(--vt-c-black-mute); + + --color-border: var(--vt-c-divider-dark-2); + --color-border-hover: var(--vt-c-divider-dark-1); + + --color-heading: var(--vt-c-text-dark-1); + --color-text: var(--vt-c-text-dark-2); + } +} + +*, +*::before, +*::after { + box-sizing: border-box; + margin: 0; + font-weight: normal; +} + +body { + min-height: 100vh; + color: var(--color-text); + background: var(--color-background); + transition: + color 0.5s, + background-color 0.5s; + line-height: 1.6; + font-family: + Inter, + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Roboto, + Oxygen, + Ubuntu, + Cantarell, + 'Fira Sans', + 'Droid Sans', + 'Helvetica Neue', + sans-serif; + font-size: 15px; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} diff --git a/src/main/webapp/src/assets/logo.svg b/src/main/webapp/src/assets/logo.svg new file mode 100644 index 0000000..7565660 --- /dev/null +++ b/src/main/webapp/src/assets/logo.svg @@ -0,0 +1 @@ + diff --git a/src/main/webapp/src/assets/main.css b/src/main/webapp/src/assets/main.css new file mode 100644 index 0000000..36fb845 --- /dev/null +++ b/src/main/webapp/src/assets/main.css @@ -0,0 +1,35 @@ +@import './base.css'; + +#app { + max-width: 1280px; + margin: 0 auto; + padding: 2rem; + font-weight: normal; +} + +a, +.green { + text-decoration: none; + color: hsla(160, 100%, 37%, 1); + transition: 0.4s; + padding: 3px; +} + +@media (hover: hover) { + a:hover { + background-color: hsla(160, 100%, 37%, 0.2); + } +} + +@media (min-width: 1024px) { + body { + display: flex; + place-items: center; + } + + #app { + display: grid; + grid-template-columns: 1fr 1fr; + padding: 0 2rem; + } +} diff --git a/src/main/webapp/src/components/HelloWorld.vue b/src/main/webapp/src/components/HelloWorld.vue new file mode 100644 index 0000000..d174cf8 --- /dev/null +++ b/src/main/webapp/src/components/HelloWorld.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/main/webapp/src/components/TheWelcome.vue b/src/main/webapp/src/components/TheWelcome.vue new file mode 100644 index 0000000..8b731d9 --- /dev/null +++ b/src/main/webapp/src/components/TheWelcome.vue @@ -0,0 +1,95 @@ + + + diff --git a/src/main/webapp/src/components/WelcomeItem.vue b/src/main/webapp/src/components/WelcomeItem.vue new file mode 100644 index 0000000..6d7086a --- /dev/null +++ b/src/main/webapp/src/components/WelcomeItem.vue @@ -0,0 +1,87 @@ + + + diff --git a/src/main/webapp/src/components/icons/IconCommunity.vue b/src/main/webapp/src/components/icons/IconCommunity.vue new file mode 100644 index 0000000..2dc8b05 --- /dev/null +++ b/src/main/webapp/src/components/icons/IconCommunity.vue @@ -0,0 +1,7 @@ + diff --git a/src/main/webapp/src/components/icons/IconDocumentation.vue b/src/main/webapp/src/components/icons/IconDocumentation.vue new file mode 100644 index 0000000..6d4791c --- /dev/null +++ b/src/main/webapp/src/components/icons/IconDocumentation.vue @@ -0,0 +1,7 @@ + diff --git a/src/main/webapp/src/components/icons/IconEcosystem.vue b/src/main/webapp/src/components/icons/IconEcosystem.vue new file mode 100644 index 0000000..c3a4f07 --- /dev/null +++ b/src/main/webapp/src/components/icons/IconEcosystem.vue @@ -0,0 +1,7 @@ + diff --git a/src/main/webapp/src/components/icons/IconSupport.vue b/src/main/webapp/src/components/icons/IconSupport.vue new file mode 100644 index 0000000..7452834 --- /dev/null +++ b/src/main/webapp/src/components/icons/IconSupport.vue @@ -0,0 +1,7 @@ + diff --git a/src/main/webapp/src/components/icons/IconTooling.vue b/src/main/webapp/src/components/icons/IconTooling.vue new file mode 100644 index 0000000..660598d --- /dev/null +++ b/src/main/webapp/src/components/icons/IconTooling.vue @@ -0,0 +1,19 @@ + + diff --git a/src/main/webapp/src/main.ts b/src/main/webapp/src/main.ts new file mode 100644 index 0000000..5dcad83 --- /dev/null +++ b/src/main/webapp/src/main.ts @@ -0,0 +1,14 @@ +import './assets/main.css' + +import { createApp } from 'vue' +import { createPinia } from 'pinia' + +import App from './App.vue' +import router from './router' + +const app = createApp(App) + +app.use(createPinia()) +app.use(router) + +app.mount('#app') diff --git a/src/main/webapp/src/router/index.ts b/src/main/webapp/src/router/index.ts new file mode 100644 index 0000000..3e49915 --- /dev/null +++ b/src/main/webapp/src/router/index.ts @@ -0,0 +1,23 @@ +import { createRouter, createWebHistory } from 'vue-router' +import HomeView from '../views/HomeView.vue' + +const router = createRouter({ + history: createWebHistory(import.meta.env.BASE_URL), + routes: [ + { + path: '/', + name: 'home', + component: HomeView, + }, + { + path: '/about', + name: 'about', + // route level code-splitting + // this generates a separate chunk (About.[hash].js) for this route + // which is lazy-loaded when the route is visited. + component: () => import('../views/AboutView.vue'), + }, + ], +}) + +export default router diff --git a/src/main/webapp/src/stores/counter.ts b/src/main/webapp/src/stores/counter.ts new file mode 100644 index 0000000..b6757ba --- /dev/null +++ b/src/main/webapp/src/stores/counter.ts @@ -0,0 +1,12 @@ +import { ref, computed } from 'vue' +import { defineStore } from 'pinia' + +export const useCounterStore = defineStore('counter', () => { + const count = ref(0) + const doubleCount = computed(() => count.value * 2) + function increment() { + count.value++ + } + + return { count, doubleCount, increment } +}) diff --git a/src/main/webapp/src/views/AboutView.vue b/src/main/webapp/src/views/AboutView.vue new file mode 100644 index 0000000..756ad2a --- /dev/null +++ b/src/main/webapp/src/views/AboutView.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/main/webapp/src/views/HomeView.vue b/src/main/webapp/src/views/HomeView.vue new file mode 100644 index 0000000..d5c0217 --- /dev/null +++ b/src/main/webapp/src/views/HomeView.vue @@ -0,0 +1,9 @@ + + + diff --git a/src/main/webapp/tsconfig.app.json b/src/main/webapp/tsconfig.app.json new file mode 100644 index 0000000..913b8f2 --- /dev/null +++ b/src/main/webapp/tsconfig.app.json @@ -0,0 +1,12 @@ +{ + "extends": "@vue/tsconfig/tsconfig.dom.json", + "include": ["env.d.ts", "src/**/*", "src/**/*.vue"], + "exclude": ["src/**/__tests__/*"], + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + + "paths": { + "@/*": ["./src/*"] + } + } +} diff --git a/src/main/webapp/tsconfig.json b/src/main/webapp/tsconfig.json new file mode 100644 index 0000000..66b5e57 --- /dev/null +++ b/src/main/webapp/tsconfig.json @@ -0,0 +1,11 @@ +{ + "files": [], + "references": [ + { + "path": "./tsconfig.node.json" + }, + { + "path": "./tsconfig.app.json" + } + ] +} diff --git a/src/main/webapp/tsconfig.node.json b/src/main/webapp/tsconfig.node.json new file mode 100644 index 0000000..822562d --- /dev/null +++ b/src/main/webapp/tsconfig.node.json @@ -0,0 +1,19 @@ +{ + "extends": "@tsconfig/node24/tsconfig.json", + "include": [ + "vite.config.*", + "vitest.config.*", + "cypress.config.*", + "nightwatch.conf.*", + "playwright.config.*", + "eslint.config.*" + ], + "compilerOptions": { + "noEmit": true, + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + + "module": "ESNext", + "moduleResolution": "Bundler", + "types": ["node"] + } +} diff --git a/src/main/webapp/vite.config.ts b/src/main/webapp/vite.config.ts new file mode 100644 index 0000000..4217010 --- /dev/null +++ b/src/main/webapp/vite.config.ts @@ -0,0 +1,18 @@ +import { fileURLToPath, URL } from 'node:url' + +import { defineConfig } from 'vite' +import vue from '@vitejs/plugin-vue' +import vueDevTools from 'vite-plugin-vue-devtools' + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [ + vue(), + vueDevTools(), + ], + resolve: { + alias: { + '@': fileURLToPath(new URL('./src', import.meta.url)) + }, + }, +}) diff --git a/src/test/java/work/xiaohh/vue/XiaohhVueApplicationTests.java b/src/test/java/work/xiaohh/vue/XiaohhVueApplicationTests.java new file mode 100644 index 0000000..38fdd0b --- /dev/null +++ b/src/test/java/work/xiaohh/vue/XiaohhVueApplicationTests.java @@ -0,0 +1,13 @@ +package work.xiaohh.vue; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class XiaohhVueApplicationTests { + + @Test + void contextLoads() { + } + +}