- 博客(22)
- 收藏
- 关注
原创 node-sass sass-loader下载依赖报错
npm install sass-loader@6.0.1 //下载指定版本 sass-loader。//下载指定版本node-sass。yarn remove node-sass@4.4.0 //卸载对应版本号。npm cache clean --force // 清除缓存。npm list node-sass //查看版本号。1.首先确定自己的node版本,命令:node -v。然后根据版本找到适合的node-sass版本;
2024-09-26 16:18:30
322
原创 小程序生命周期
onLoad: function(options) {// 页面创建时执行},onShow: function() {// 页面出现在前台时执行},onReady: function() {// 页面首次渲染完毕时执行},onHide: function() {// 页面从前台变为后台时执行},onUnload: function() {// 页面销毁时执行},onPullDownRefresh: function() {// 触发下拉刷新时执行},onReachBott
2021-04-12 16:01:35
127
转载 各种文件用JS转Base64之后的data类型
1.txt data:text/plain;base64,2.doc data:application/msword;base64,3.docx data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,4.xls data:application/vnd.ms-excel;base64,5.xlsx data:application/vnd.openxm
2021-04-12 14:06:38
467
转载 javascript对象的浅拷贝、深拷贝和Object.assign方法浅析
javascript对象的浅拷贝、深拷贝和Object.assign方法浅析这篇文档写的很好 https://segmentfault.com/a/1190000014107100
2020-08-13 15:47:51
154
转载 项目非组件文件进行路由跳转【react与vue等其他框架均可使用】
在我们项目的开发过程中除了在我们的组件内部进行路由跳转再就是通过全局配置路由进行跳转今天要说的是有特殊的情况需要在公共方法文件里进行路由跳转想要实现这个也很简单,只需要引入history库。npm i history --save而后比如说在utils文件里面使用:import { createHashHistory } from 'history'; // hash路由// 或者import { createBrowserHistory } from 'history'; // histo
2020-07-17 10:32:39
290
原创 react 项目关于性能优化
react 项目关于性能优化1.在页面加载的时候,会渲染render()下面的标签,会造成在不必要的情况下被调用render.组件渲染的过程中,有时候并没用到props或者state的值,或者组件的props或者state并没有在父组件重新绘染时发生改变。这意味着重新绘染这个组件会得到和已知虚拟DOM一模一样的结果。可以通过shouldComponentUpdate来控制。关于shouldComponentUpdate:组件更新生命周期中必调用shouldComponentUpdate,字面意思是组
2020-07-15 14:59:33
261
转载 写一个函数,实现21点算法,它根据参数的值来递增或递减变量?
var count = 0;function cc(card) {var cards={2:1,3:1,4:1,5:1,6:1,7:0,8:0,9:0,10:-1,“J”:-1,“Q”:-1,“K”:-1,“A”:-1};count=count+cards[card];if(count>0){return count+" Bet";}else{return count+" Ho...
2019-07-29 13:20:00
448
转载 运行报错
在webstorm中运行 npm install 报错:Error: Cannot find module ‘eslint-config-prettier/@typescript-eslint’解决方法:npm i eslint-config-prettier@latest参考地址:https://github.com/prettier/eslint-config-prettier/issu...
2019-07-24 17:37:15
484
原创 虚拟机配置
输入你的账号和密码,然后进入顶级用户[root@localhost chenlu]# su( systemctl stop firewalld 暂时关闭防火墙systemctl disable firewalld 永久关闭防火墙)永久关闭防火墙:[root@localhost ]# systemctl disable firewalldRemoved symlink /etc/sys...
2019-07-23 12:38:06
134
原创 鼠标事件、键盘事件
鼠标事件:div.onclick//点击事件div.onmousedown//鼠标按下事件div.onmouseup//鼠标抬起事件div.onmouseenter//鼠标进入事件 屏蔽事件冒泡div.onmouseleave//鼠标移出事件 屏蔽事件冒泡div.onmousemove//鼠标移动事件 鼠标在事件源内部移动每移动一像素就会触发事件div.onmouseover...
2019-07-05 15:26:22
195
转载 6种继承方式
继承1.既然要实现继承,那么首先我们得有一个父类,代码如下 :继承也可以继承var私有的东西;// 定义一个动物类function Animal (name) { // 属性 this.name = name || 'Animal'; // 实例方法 this.sleep = function(){ console.log(this.name + '正在睡觉!');...
2019-07-05 15:23:31
279
原创 图片放大镜
<head> <meta charset="UTF-8"> <title>zoom</title> <style type="text/css"> *{ margin: 0; padding: 0; } #small{ width: 300px; height: 300px; positio...
2019-04-10 16:22:11
427
原创 客户评论打星星,显示满意度代码
<head> <meta charset="UTF-8"> <title></title> <style type="text/css"> #ul1{padding: 0;margin: 0;list-style: none;width:300px;height: 28px;} #ul1 li{float: left;bac...
2019-04-10 16:16:25
854
原创 同一个元素上挂相同事件
通过数组的方法:1.var app=document.getElementById(“app”);var e=[function(){alert(1);},function(){alert(2); }];app.function(){e0;e1;}2.var app=document.getElementById(“app”);app.function(){for(...
2019-04-10 16:08:20
153
翻译 对于数组排序的三种方法
//快速排序法var a=[1,2,34,4,78];for(var i=0;i<a.length-1;i++){for(var star=0;star<a.length-1-i;star++){if(a[star]>a[star+1]){var temp=a[star];a[star]=a[star+1];a[star+1]=temp;} } }...
2019-04-10 16:05:57
828
原创 “雷电”小游戏
JS部分:;(function(){var obj=function(){var div;var body;var plane;var blood;var flag=false;var player=function(){var left;if(div.currentStyle){//IE浏览器left.div.currentStyle.left;...
2019-04-10 15:55:44
649
转载 rgba和opacity的区别
rgba()和opacity都能实现透明效果,取值0~1之间。取值 为0表示完全透明,取值为1时表示完全不透明。但区别在于:rgba()只作用于元素自身的颜色或背景色,对元素的内容没有影响;opacity在作用于元素自身的颜色或背景色的同时,也作用于元素内的内容的透明度...
2019-02-28 18:05:08
212
原创 超链接标签
分类:1.页面间链接:从一个页面跳转到另一个页面2.锚链接:1):从页面A的位置跳转到这个页面的B位置在要跳转的目标位置做记号,取一个ID值,在要点击的链接中写 href="#id值"。2):从甲页面A位置跳转到乙页面的B位置在要跳转的目标位置做记号,取一个ID值,在要点击的链接中写 href=“跳转文件的路径.html #id值”。3.功能性链接:通过一个链接打开一个应用程序...
2019-01-23 08:46:19
160
转载 获取元素,动态添加、删除元素以及getElementByTagName、和getElementByClassName)的用法
1.获取元素(1)getElementById根据元素的id属性来获取元素,获取到的是一个元素(2)getElementByTagName根据标签名来获取元素,结果是一个元素集合(3) getElementByClassName根据class属性来获取元素,结果是一个元素集合(4) getElementByName根据name属性来获取元素,结果是一个元素集合总结:获取元素可以...
2018-12-19 16:30:32
1587
原创 JS 求一组数组中的最大值,最小值(不包括0)。
<body> <script type="text/javascript"> var arr=[]; do{ var num=prompt("请输入一个整数:") if(num!=0){ arr.push(num); } ...
2018-12-09 22:14:07
1308
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人