上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 34 下一页
摘要: 嵌套路由:当我们点击一个链接,就会显示一个组件。在一级路由的组件中显示二级路由就是嵌套路由。 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="text/javascript" src 阅读全文
posted @ 2022-07-12 12:06 临易 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 1.通配符(*):*可以匹配任意路径 例如: {path:"/*",component:t5}, //表示匹配所有路径 {path:"/user-*",component:t5}, //表示匹配所有以user开头的路径 const myrouter = new VueRouter({ routes: 阅读全文
posted @ 2022-07-12 11:46 临易 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 路由router:是由vue官方提供的用于实现组件跳转的插件。基于vue。 1.路由插件的引用。 离线引用: 下载js文件:v4.x: https://unpkg.com/vue-router@4.1.2/dist/vue-router.global.js v3.x: https://unpkg.c 阅读全文
posted @ 2022-07-12 11:22 临易 阅读(66) 评论(0) 推荐(0) 编辑
摘要: axios回调函数的参数res:回调函数的res并不是接口返回的数据,而是表示一个响应对象。res.data才表示接口响应的数据。 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <script type="t 阅读全文
posted @ 2022-07-12 10:30 临易 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 执行多个并发请求: axios.get(url1).then(function(res1){ //处理结果1 }); axios.get(url2).then(function(res2){ //处理结果2,不可写这里,可能因为网络影响,1还未执行完 }); //处理结果(需要等待两个请求都返回数据 阅读全文
posted @ 2022-07-12 09:59 临易 阅读(33) 评论(0) 推荐(0) 编辑
摘要: axios提供了多种异步请求方法,实现对RESTful风格的支持。 1.get请求 axios.get(url).then(function); axios.get(url,{}).thrn(function); //使用axios的get请求传递参数,需要将参数设置在params下axios.ge 阅读全文
posted @ 2022-07-11 18:43 临易 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 1.axios:vue可以实现数据的渲染,但是如何获取数据? vue本身不具备通信能力,通常结合axios——一个专注于异步通信的js框架来使用。 axios负责数据通信,vue负责数据渲染。 2.axios入门使用: 原生ajax:实现步骤复杂。 jQuery:笨重。 axios:专注于异步通信。 阅读全文
posted @ 2022-07-11 18:22 临易 阅读(71) 评论(0) 推荐(0) 编辑
摘要: 1.组件定义: 定义组件时,将组件中的数据绑定到slot标签。 Vue.component("page-frame",{ template:`<div> <div id="header" style="width:100%; height:100px; background:pink"> <slot 阅读全文
posted @ 2022-07-11 17:39 临易 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 具名插槽:当组件中的插槽数量大于1时,我们需要给组件中的slot标签添加name属性指定插槽的名字。 1.定义组件 Vue.component("page-frame",{ template:`<div> <div id="header" style="width:100%; height:100p 阅读全文
posted @ 2022-07-11 16:51 临易 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 当我们自定义vue组件时,允许组件中的部分内容在调用组件时进行自定义。————插槽。 1.js中定义插槽: 在自定义组件中通过<slot>标签在模板中定义插槽。 //定义一个header-bar组件 Vue.component("header-bar",{ data:function(){ //组件 阅读全文
posted @ 2022-07-11 15:55 临易 阅读(35) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 34 下一页