const routes = [
{path: “/”, redirect: “/home”},
{path: “/home”, component: Home},
{
path: “/user”, component: User,
children: [ // 嵌套路由
{path: “add”, component: UserAdd},
{path: “edit”, component: UserEdit}
]
},
{path: “/student”, component: Student},
];
const router = new VueRouter({
mode: “history”,
base: process.env.BASE_URL,
routes
});
export default router;
用户列表
修改
添加
================================================================================
RAP2 官网:http://rap2.taobao.org/
这个网站很牛逼,可以创建后端接口,自定义请求和响应,可以创建返回 Json 格式数据的 URL,然后拿这个 URL 给前端开发人员进行测试。
切换路由组件的显示: this.$router.push(“/xxx”)
=======================================================================================================
使用 this.$router.push("/user")
切换路由组件的显示;
saveUserInfo() {
console.log(this.user);
this.$http.post(“http://rap2.taobao.org:38080/app/mock/259261/user/add”, this.user).then((res) => {
if (res.data.success) { // 添加成功
this.$router.push(“/user”); // 切换路由
}
});
}
=============================================================================
watch: { // 监听路由的变化
$route: {
handler: function (val, oldVal) {
console.log(val);
if (val.path == “/user”) {
// this.findAll();
}
},
// 深度观察监听
deep: true
}
}
===================================================================================
@RequestBody
作用:将前端传递的 Json格式数据 转换为 Java对象。
前端传递 Json格式数据:
后台控制器用 @RequestBody
将 Json 转为 Java 对象:
=======================================================================================
最后
面试题文档来啦,内容很多,485页!
由于笔记的内容太多,没办法全部展示出来,下面只截取部分内容展示。
1111道Java工程师必问面试题
MyBatis 27题 + ZooKeeper 25题 + Dubbo 30题:
Elasticsearch 24 题 +Memcached + Redis 40题:
Spring 26 题+ 微服务 27题+ Linux 45题:
Java面试题合集:
yBatis 27题 + ZooKeeper 25题 + Dubbo 30题:**
[外链图片转存中…(img-FfhDEfhk-1714480307589)]
Elasticsearch 24 题 +Memcached + Redis 40题:
[外链图片转存中…(img-gWqBTAOc-1714480307589)]
Spring 26 题+ 微服务 27题+ Linux 45题:
[外链图片转存中…(img-KyfkYU61-1714480307590)]
Java面试题合集:
[外链图片转存中…(img-LGq96ZZj-1714480307590)]