摘要: 一、配置axios请求响应拦截 在src/utils/request.js import axios from "axios"; //拦截器(请求,响应) //响应 axios.interceptors.response.use(res => { //成功 return res.data; }, e 阅读全文
posted @ 2022-11-25 12:22 默永 阅读(576) 评论(0) 推荐(0) 编辑
摘要: vue无限滚动加载 1、使用防抖完成无限加载 export default { data() { return { menuList: {}, time: null, page: 1, loading: true, }; }, methods: { windowScroll() { this.tim 阅读全文
posted @ 2022-11-25 09:52 默永 阅读(474) 评论(0) 推荐(0) 编辑
摘要: css弹性盒子 display:flex 属性 <style> .box { height: 300px; background-color: red; /*将容器转换为弹性盒子*/ display: flex; /* flex-start -> 默认值;主轴方向开始 center -> 居中 fl 阅读全文
posted @ 2022-11-22 10:20 默永 阅读(33) 评论(0) 推荐(0) 编辑
摘要: vue创建项目、初始化项目、vue请求代理 条件: @vue/cli 5.0.4 node /v14.0.0 一、安装脚手架工具 @vue/cli npm install -g @vue/cli npm install -g @vue/cli@5.x.x //后面跟着版本号 //如果****慢,可以 阅读全文
posted @ 2022-11-15 15:18 默永 阅读(177) 评论(0) 推荐(0) 编辑
摘要: nunjucks模板中循环数字 {% for i in range(0,10) %} {{loop.index}} {% endfor %} 使用range方法 loop.index是循环次数 阅读全文
posted @ 2022-11-15 09:01 默永 阅读(77) 评论(0) 推荐(0) 编辑
摘要: js实现鼠标图片放大缩小 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport 阅读全文
posted @ 2022-11-14 14:00 默永 阅读(695) 评论(0) 推荐(0) 编辑
摘要: 在js中,function可以看做为方法,构造函数可以看做为类 在Es6中,class(类)作为对象的模板被引用,可以通过class关键字定义;class的本质是function Es5就支持class概念 贴点: 1. 类声明不可以重复 2. 类必须使用new 调用,否则会报错 3. 类中创建方法 阅读全文
posted @ 2022-11-11 16:06 默永 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 构造函数 构造函数在创建实例后,是无法在进行添加属性的,所以每个构造函数都有一个prototype属性,这个属性指定一个原型对象,这个原型对象上的所有属性和方法都可以被构造函数的实例使用。 prototype 构造函数名.prototype.属性名 = 属性值 基于原型的继承 继承是一种关系,父类与 阅读全文
posted @ 2022-11-11 09:52 默永 阅读(87) 评论(0) 推荐(0) 编辑
摘要: function ****ysisTime(time) { const _d1 = new Date(); const dateDiffer = Math.abs(_d1.getTime() - time); //准换年 const year = Math.floor(dateDiffer / (1 阅读全文
posted @ 2022-11-10 13:06 默永 阅读(22) 评论(0) 推荐(0) 编辑
摘要: (网页跳转到指定位置)有时候,我们想阅读页面中某段精彩的内容,但由于页面太长,用户需要自己滚动页面,查找起来非常麻烦 ,这样体验非常不好,所以我们要实现点击某段文字或者图片跳转到页面指定位置,方便用户的阅读。 方法一 利用 id 为标记的 锚点 这里作为锚点的标签可以是任意元素。 <p id="ti 阅读全文
posted @ 2022-11-10 09:15 默永 阅读(271) 评论(0) 推荐(0) 编辑