- 博客(20)
- 收藏
- 关注
原创 react 使用swiper插件
首先引入插件 npm i swiper import { Component } from 'react'; import { Swiper, SwiperSlide } from 'swiper/react'; import SwiperCore, { Autoplay, Navigation, Pagination } from 'swiper/core'; import 'swiper/css'; import 'swiper/css/bundle'; import Style from './FJM
2022-05-31 11:33:56
963
原创 网页适配,判断浏览当前网页的设备是pc还是Mobile
isMobile: function () { const ua = navigator.userAgent.toLowerCase(); if (ua.match(/mobile/)) { return true; } return false; },
2022-05-13 16:26:51
228
原创 js 在可输入的元素中 获取选中的范围
start: DOM.selectionStart, //选中开始的位置 end: DOM.selectionEnd //选中结束的位置
2022-03-17 11:14:05
350
原创 一段文字获取鼠标选中的范围和文字
//获取选中的范围 getSelectedRange() { var range = document.createRange(); range.selectNode(this.box_ref); var selection = window.getSelection(); var start = selection.anchorOffset; var end = selection.focusOffset;
2022-03-17 11:08:13
478
原创 google drive 前端上传
粘贴到项目中,并运行。 <html lang="en"> <head> <meta charset="utf-8"/> <link rel="icon" href="%PUBLIC_URL%/favicon.ico"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <meta name="theme-color" c
2022-01-11 16:19:11
803
原创 一键复制内容
JS点击粘贴内容 //界面部分 textarea需正常显示否则不能实现功能 <textarea ref={ele => (this._copyUrlRef = ele)} className={styles.copy_link_textarea} readOnly='readOnly' value={shareLink} /> //js部分 触发select()事件 this._copyUrlRef.select() d
2021-12-28 15:33:14
437
原创 JS数组方法
join() 将数组中的每一项数据按自己设定的连接符连接成字符串 var arr = [1,2,3]; console.log(arr.join()); // 1,2,3 console.log(arr.join("-")); // 1-2-3 console.log(arr); // [1, 2, 3](原数组不变) push()和pop() arr.push()在数组后面添加数据 push()...
2020-03-23 16:39:11
124
原创 vue项目使用进度条
第一步引入nprogress 包 $ npm install --save nprogress 或者 //用法 NProgress.start(); NProgress.done(); 第二步如何使用 在request.js或router.js中引入 import NProgress from ‘nprogress’ axios请求拦截器中使用NProgress.start(); axios.in...
2020-03-23 14:10:35
674
原创 vue中的.sync修饰符用法及原理详解
1、不使用.sync时 //父组件给子组件传入一个函数 //se6的写法 <MyFooter :age=“age” @setAge="(res)=> age = res"/> //子组件通过调用这个函数来实现修改父组件的状态。 mounted () { console.log(this.$emit(‘setAge’,1234567)); } 2、使用.sync时 //父组件将ag...
2020-03-12 15:52:47
772
原创 vue自定义全局指令
1、例如添加全局v-focus指令 Vue.directive(‘focus’,{ //inserted表示 插入到dom的时候触发 inserted(el){ //el代表当前绑定的元素 el.focus() }, //当指令被绑定到元素上时 触发 bind(el){ el.focus() }, // updataed(el){ el.focus() } }) ...
2020-03-10 15:35:09
157
原创 vue生命周期函数
1、beforeCreaed() 实例创建出来之前 2、created() 实例创建出来之后 3、beforeMount() 挂载前 4、mounted() 挂载 5、beforeupdate() 更改前 6、updated() 更改 7、beforeDestroy() 销毁前 8、destroyed() 销毁 ...
2020-03-10 14:45:06
128
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅
1