2024年12月4日22:04:49

main
LeJingS 5 months ago
parent 873c643877
commit 573c44a239

@ -54,11 +54,7 @@
<script setup> <script setup>
import { ref,reactive,onMounted} from 'vue' import { ref,reactive,onMounted} from 'vue'
import axios from 'axios' import axios from 'axios'
let people = reactive([ 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 // api
@ -66,10 +62,11 @@
axios.get('http://localhost:8080/selectAll') axios.get('http://localhost:8080/selectAll')
.then(res => { .then(res => {
// 使 // 使
people.splice(0, people.length);
people.push(...res.data) people.push(...res.data)
}) })
.catch(error => console.error('There was an error fetching the data!', error)) .catch(error => console.error('There was an error fetching the data!', error))
} }
@ -95,7 +92,13 @@ function addList() {
console.log(games); console.log(games);
} }
// deleteItem(g.id)
function deleteItem(id) {
console.log(id);
axios.delete(`http://localhost:8080/delete?id=${id}`)
getAll();
}
onMounted(() => { onMounted(() => {
getAll(); getAll();
@ -103,8 +106,10 @@ onMounted(() => {
</script> </script>
<style> <style>
.person .list { .person .list {

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="RemoteRepositoriesConfiguration"> <component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository> <remote-repository>
<option name="id" value="central" /> <option name="id" value="central" />
<option name="name" value="Maven Central repository" /> <option name="name" value="Maven Central repository" />

@ -8,7 +8,7 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="23" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

@ -2,11 +2,13 @@ package top.lejings.db.http;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import top.lejings.db.mapper.delete; import top.lejings.db.mapper.delete;
@RestController @RestController
@CrossOrigin(origins = "http://localhost:5173")
public class httpDelete { public class httpDelete {
@Autowired @Autowired
private delete delete; private delete delete;

@ -2,11 +2,13 @@ package top.lejings.db.http;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import top.lejings.db.mapper.insert; import top.lejings.db.mapper.insert;
@RestController @RestController
@CrossOrigin(origins = "http://localhost:5173")
public class httpInsert { public class httpInsert {
@Autowired @Autowired

@ -1,6 +1,7 @@
package top.lejings.db.http; package top.lejings.db.http;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import top.lejings.db.mapper.selectById; import top.lejings.db.mapper.selectById;
@ -10,6 +11,7 @@ import top.lejings.db.people;
import java.util.List; import java.util.List;
@RestController @RestController
@CrossOrigin(origins = "http://localhost:5173")
public class httpSelect { public class httpSelect {
@Autowired @Autowired
private selectById selectById; private selectById selectById;

@ -1,11 +1,13 @@
package top.lejings.db.http; package top.lejings.db.http;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import top.lejings.db.mapper.update; import top.lejings.db.mapper.update;
@RestController @RestController
@CrossOrigin(origins = "http://localhost:5173")
public class httpUpdate { public class httpUpdate {
@Autowired @Autowired
private update update; private update update;

Loading…
Cancel
Save