2020年4月17日

摘要: 1.基本使用 Fetch 是一个新的端获取资源的接口,用于替换笨重繁琐XMLHttpRequest.它有了Request 和 Response 以及Headers对象的概念,与后端语言请求资源更接近。 一个简单的GET请求 fetch('https://www.baidu.com') .then(r 阅读全文

posted @ 2020-04-17 15:52 博客sl 阅读(746) 评论(0) 推荐(0) 编辑

摘要: React.createClass({ propTypes: { // 可以声明 prop 为指定的 JS 基本类型。默认 // 情况下,这些 prop 都是可传可不传的。 optionalArray: React.PropTypes.array, optionalBool: React.PropT 阅读全文

posted @ 2020-04-17 13:10 博客sl 阅读(1164) 评论(0) 推荐(0) 编辑

2020年4月15日

摘要: 自定义事件 // e 代表触发的事件对象window.addEventListener("huangbiao", function (e) { console.log(arguments); debugger if (e.myAttr "demo") { alert("key值为demo,添加成功! 阅读全文

posted @ 2020-04-15 15:33 博客sl 阅读(479) 评论(0) 推荐(0) 编辑

摘要: display:inline-block是一种布局方法,它相比于与浮动、定位最大的不同就是其没有父元素的匿名包裹特性,这使得display:inline-block属性的使用非常自由,可与文字,图片混排,可内嵌block属性元素,可以置身于inline水平的元素中。 在CSS布局中,如果我们想要将一 阅读全文

posted @ 2020-04-15 11:24 博客sl 阅读(390) 评论(0) 推荐(0) 编辑

2020年4月9日

摘要: 一、原生JS中的Ajax:1、使用ajax发送数据的步骤 第一步:创建异步对象 var xhr = new XMLHttpRequest();第二步:设置 请求行 open(请求方式,请求url): // get请求如果有参数就需要在url后面拼接参数,// post如果有参数,就在请求体中传递 x 阅读全文

posted @ 2020-04-09 12:42 博客sl 阅读(2897) 评论(0) 推荐(0) 编辑

2020年4月8日

摘要: Vue Baidu Map:https://dafrok.github.io/vue-baidu-map/#/zh/start/usage 全局注册 全局注册将一次性引入百度地图组件库的所有组件。 import Vue from 'vue' import BaiduMap from 'vue-bai 阅读全文

posted @ 2020-04-08 13:54 博客sl 阅读(386) 评论(0) 推荐(0) 编辑

2020年4月7日

摘要: vuex实际项目中的应用实例: import Vue from 'vue' import Vuex from 'vuex' import Base64 from '../common/base64.js'; import { request, getUserInfo, getCartlist } f 阅读全文

posted @ 2020-04-07 21:33 博客sl 阅读(562) 评论(0) 推荐(0) 编辑

摘要: axios拦截器 在src目录下的api目录创建一个js文件 import axios from 'axios' //引入axios //下面这两个不一定需要引入,看你项目需要拦截的时候做什么操作,但是一般都需要引入store import store from '@/store/index' // 阅读全文

posted @ 2020-04-07 21:00 博客sl 阅读(164) 评论(0) 推荐(0) 编辑

2020年4月3日

摘要: document.createEvent用于创建事件, 在DOM Level 2 的事件中就有HTMLEvents,MouseEvents,UIEvents事件类型。DOM Level 3增加很多事件类型,个人觉得其中最有用的是CustomEvent自定义事件。 为DOM元素创建自定义事件的步骤为: 阅读全文

posted @ 2020-04-03 19:28 博客sl 阅读(2845) 评论(0) 推荐(0) 编辑

2020年4月2日

摘要: Ajax上传文件(原生JS篇) <div class='progress'> <div class="step"></div> </div> <form action=""> <input type="text" name='name' placeholder="请输入姓名"> <input typ 阅读全文

posted @ 2020-04-02 21:59 博客sl 阅读(127) 评论(0) 推荐(0) 编辑