commit
075e24a67b
@ -0,0 +1,30 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
.DS_Store
|
||||
dist
|
||||
dist-ssr
|
||||
coverage
|
||||
*.local
|
||||
|
||||
/cypress/videos/
|
||||
/cypress/screenshots/
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
*.tsbuildinfo
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["Vue.volar"]
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
# db
|
||||
|
||||
This template should help get you started developing with Vue 3 in Vite.
|
||||
|
||||
## Recommended IDE Setup
|
||||
|
||||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).
|
||||
|
||||
## 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
|
||||
```
|
@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Vite App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "db",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "run-p type-check \"build-only {@}\" --",
|
||||
"preview": "vite preview",
|
||||
"build-only": "vite build",
|
||||
"type-check": "vue-tsc --build"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.8",
|
||||
"vue": "^3.5.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/node22": "^22.0.0",
|
||||
"@types/node": "^22.9.3",
|
||||
"@vitejs/plugin-vue": "^5.2.1",
|
||||
"@vue/tsconfig": "^0.7.0",
|
||||
"npm-run-all2": "^7.0.1",
|
||||
"typescript": "~5.6.3",
|
||||
"vite": "^6.0.1",
|
||||
"vite-plugin-vue-devtools": "^7.6.5",
|
||||
"vue-tsc": "^2.1.10"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,22 @@
|
||||
<template>
|
||||
|
||||
<div>
|
||||
<Person></Person>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script >
|
||||
import Person from './Person.vue'
|
||||
|
||||
export default {
|
||||
name: 'App',
|
||||
// 注册组件
|
||||
components: {
|
||||
Person
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<div class="person">
|
||||
<div class="operate">
|
||||
id<input type="text" name="id">
|
||||
姓名<input type="text" name="name">
|
||||
密码<input type="text" name="password">
|
||||
邮箱<input type="text" name="email">
|
||||
<button @click="findList">查询</button>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div class="operate">
|
||||
<!-- id<input type="text" name="addId" v-model="addId"> -->
|
||||
姓名<input type="text" name="addName" v-model="addName">
|
||||
密码<input type="text" name="addPassword" v-model="addPassword">
|
||||
邮箱<input type="text" name="addEmail" v-model="addEmail">
|
||||
<button @click="addList">添加</button>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="list">
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>id</th>
|
||||
<th>name</th>
|
||||
<th>password</th>
|
||||
<th>email</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
|
||||
<tr v-for="g in people" :key="g.id">
|
||||
<td>{{g.id}}</td>
|
||||
<td>{{g.name}}</td>
|
||||
<td>{{g.password}}</td>
|
||||
<td>{{g.email}}</td>
|
||||
|
||||
<td>
|
||||
<button @click="updateItem(g.id)">修改</button>
|
||||
<button @click="deleteItem(g.id)">删除</button>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref,reactive,onMounted} from 'vue'
|
||||
import axios from 'axios'
|
||||
let people = reactive([
|
||||
{ id: 'ahsgdyfa01', name: '英雄联盟' ,password:'23456',email:'123456@qq.com'},
|
||||
{ id: 'ahsgdyfa02', name: '王者荣耀' ,password:'3456',email:'123456@qq.com'},
|
||||
{ id: 'ahsgdyfa03', name: '原神',password:'456',email:'123456@qq.com' }
|
||||
])
|
||||
|
||||
|
||||
// 查找全部的方法api
|
||||
function getAll() {
|
||||
axios.get('http://localhost:8080/selectAll')
|
||||
.then(res => {
|
||||
// 使用扩展运算符来保持响应性
|
||||
people.push(...res.data)
|
||||
})
|
||||
.catch(error => console.error('There was an error fetching the data!', error))
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 定义添加表单的数据
|
||||
let addId = ref('');
|
||||
let addName = ref('');
|
||||
let addPassword = ref('');
|
||||
let addEmail = ref('');
|
||||
|
||||
function addList() {
|
||||
games.push({
|
||||
id: addId.value,
|
||||
name: addName.value,
|
||||
password: addPassword.value,
|
||||
email: addEmail.value
|
||||
});
|
||||
// 清空输入框
|
||||
addId.value = '';
|
||||
addName.value = '';
|
||||
addPassword.value = '';
|
||||
addEmail.value = '';
|
||||
|
||||
console.log(games);
|
||||
}
|
||||
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
getAll();
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<style>
|
||||
.person .list {
|
||||
display: flex;
|
||||
justify-content: center; /* 水平居中 */
|
||||
align-items: center; /* 垂直居中 */
|
||||
height: 100vh; /* 使容器高度占满整个视口 */
|
||||
}
|
||||
.person .operate {
|
||||
display: flex; /* 启用 Flexbox 布局 */
|
||||
justify-content: center; /* 水平居中 */
|
||||
gap: 10px; /* 设置元素之间的间距 */
|
||||
align-items: center; /* 垂直居中对齐 */
|
||||
|
||||
}
|
||||
</style>
|
@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
createApp(App).mount('#app')
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||
"include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
|
||||
"exclude": ["src/**/__tests__/*"],
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.node.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.app.json"
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
{
|
||||
"extends": "@tsconfig/node22/tsconfig.json",
|
||||
"include": [
|
||||
"vite.config.*",
|
||||
"vitest.config.*",
|
||||
"cypress.config.*",
|
||||
"nightwatch.conf.*",
|
||||
"playwright.config.*"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"noEmit": true,
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
||||
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"types": ["node"]
|
||||
}
|
||||
}
|
@ -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))
|
||||
},
|
||||
},
|
||||
})
|
Loading…
Reference in new issue