- 博客(67)
- 收藏
- 关注
转载 app 检测总结
1.upload: 文件校验:const apkArray = file.name.split("."); const isApk = apkArray[apkArray.length-1] === 'apk'; const isLt100M = file.size / 1024 / 1024 <...
2019-09-29 15:36:00
166
转载 移动端vw rem
html { font-size: 16px;}@media screen and (min-width: 375px) { html { /* iPhone6的375px尺寸作为16px基准,414px正好18px大小, 600 20px */ font-size: calc(100% + 2 * (100vw -...
2019-08-19 13:27:00
158
转载 redux 总结
1.状态管理 提供全局的状态。2.一般逻辑:首先创建store文件夹,创建index文件,引入createStore 以及reducer 对外暴露出store,store = createStore(reducer) reducer为一个纯函数,即返回的结果只于传入的参数相关,与其他全局变量无关。接受两个参数,previousState action。...
2019-08-14 09:34:00
155
转载 原生js操作类名
为 <div> 元素添加 class:document.getElementById("myDIV").classList.add("mystyle");为 <div> 元素添加多个类:document.getElementById("myDIV").classList.add("mystyle", "anotherClass", "thirdC...
2019-08-08 14:47:00
696
转载 react 踩坑
1.安装了 node2.安装了 create-react-app3.执行代码 create-react-app 报错create-react-app 不是内部命令解决方法:1.更新你的npm版本 npm install -g npm@latest 2.npx create-react-app myReact4.缺陷:初始化慢 ,解决:h...
2019-08-07 15:11:00
123
转载 数组方法
let arr = [1,2,4,5,6];let newArr = [];//es6 新增数组方法//forEach(); 遍历数组每一项,让每一项做某件事(执行callback函数);不能使用return//forEach 参数: callback this对象(执行 callback 函数时使用的this 值。)//callback参数:item index arra...
2019-08-07 13:36:00
100
转载 原型链拾遗
function Foo(){}let f1 = new Foo();console.log(Foo.prototype.constructor === Foo);console.log(f1.constructor === Foo);console.log(f1.__proto__ === Foo.prototype);View Code...
2019-08-05 16:25:00
104
转载 css 省略号
overflow:hidden;text-overflow:ellipsis;white-space:nowrap;转载于:https://www.cnblogs.com/tutao1995/p/11280680.html
2019-08-01 09:47:00
98
转载 复习数组去重
var a = [3, 62, null, 0, 38, undefined, NaN,NaN, ' ', 38, " "];//1.set+array 不能区别nan '' ""// 优点:代码简洁,速度快 时间复杂度O(N) //缺点:需要一个额外的set和array的存储空间,空间复杂度 O(N)function uniqueArray(...
2019-07-24 11:45:00
105
转载 test
const Koa = require('koa');const Router = require('koa-router');const bodyparser = require('koa-bodyparser');var mongoose = require('mongoose');var Schema = mongoose.Schema;let _url...
2019-07-02 17:02:00
143
转载 koa 链接 mongodb报错
1.confused 数据库服务器未开启2.MongoNetworkError: failed to connect to server [localhost:27017] on first connect [[object Object]] 链接数据库的时候 将url 写成了 localhost ,把localhost 修改为127.0.0.1转载于:...
2019-07-02 16:37:00
118
转载 git 简单记
1.下载安装git2.注册GitHub账号3.本地打开git4.mkdir 创建 文件夹5.git cd 该文件夹 git init 执行 ls -ah 可以看到多了一个 .git的目录6.再创建的文件夹中创建一个readme.txt 里面随便写点啥7.git 进入文件夹 执行 git add rea...
2019-06-28 16:25:00
139
转载 mongodb 简单记
了解:mongodb 为非关系型数据库 即 no SQL ,,创新性足 ,自由度高,灵活 ;一般所熟悉的mySQL lite SQLServer 等都是关系型数据库 主要 标准统一 ,创新性不足 ,自由度不高1.安装2.添加修改 环境变量里的path 即mongodb安装位置的bin目录的路径3.如果是4.0版本以前 ...
2019-06-28 10:48:00
89
转载 mongoose
1.var mongoose = require('mongoose');2.mongoose.connect(数据库路径);3.定义schema var newsSchema = mongoose.Schema({})4.定义操作数据的model var news = mongoose.model('new',newsSchema)5.增删改查 a....
2019-06-27 17:01:00
89
转载 前端 常用工具总结
js:// 1.类型检测类//字符串function isString(o){return Object.prototype.toString.call(o).slice(8,-1) === 'String'}//数字function isNumber(o){return Object.prototype.toString.call(o).slice(...
2019-06-27 11:12:00
119
转载 koa 学习
1.下载node2.npm init -yes 创建package.json 3.npm install koa 下载koa4.npm install nodemon -d 实时更新服务 不用重新开启5.在package.json 下面修改 test 为 start 后面内容为 nodemon app.js6.在根目录下创建 app...
2019-06-27 11:07:00
117
转载 vue 学习总结(一)
1.methods 和 computed 区别答:相同:都可以对data里面的数据进行操作。区别:methods每次操作都会重新渲染,重新请求 。 computed 的改变在于其操作依赖是否改变,如果未改变,则继续调用上次缓存下来的内容。 好处:对于相应的数据量较大时,避免了重复请求。节约了开销2.watch使用场景答:来响应数据的变化。当需要在数据变化时执行异...
2019-06-20 15:29:00
192
转载 动态监听input输入
$(".card").bind('input propertychange', function() { let len = $(".card").val().length; if(len === 10){ $(".commit").click(); }});动态监听input 键盘输入原生jsdocument.getElementById("xxxx")...
2019-06-17 15:47:00
226
转载 js 模拟enter键
jqlet event = JQuery.event('keydown');event.keyCode = 13;$("input.pagination-num").trigger(e);//模拟页码框按下回车js:window.document.onkeydown = function(e){ var isE = e || event; i...
2019-06-17 15:45:00
2481
转载 vue 学习
1.可以通过 VM.$data 访问data属性 2.data里面的属性名不能含有_和$ ,可能与内置方法冲突 ,可以通过VM.$data._xxx访问3.计算属性是基于它们的依赖进行缓存的。计算属性只有在它的相关依赖发生改变时才会重新求值。这就意味着只要message还没有发生改变,多次访问reversedMessage计算属性会立即返回之前的计算结果,而不必再次...
2019-03-28 18:03:00
102
转载 js 点击事件
js的点击事件和hover一样,包含两个动作,进入 和 离开 ,可以用mousedown() 和 mouseup() 代替执行过程。转载于:https://www.cnblogs.com/tutao1995/p/10562896.html...
2019-03-20 09:33:00
204
转载 快速排序 踩坑
迷糊版本: function quickSort(arr){var arrLen = arr.length;if(arrLen <= 1){return arr}var pivotIndex = Math.floor(arrLen/2);var pivot = arr.splice(pivotIndex,1)[0];var ...
2019-03-13 09:43:00
127
转载 call,apply,bind,this
1.this:js的this总是指向一个对象,具体那个对象是运行时基于函数的执行环境动态绑定的,而非函数声明时的环境。 this的指向(除去eavl和with): a.作为对象的方法调用 :this指向对象本身 b.作为普通函数调用(函数自执行,匿名函数) :this指向window对象 c.构造器调用 d.app...
2019-03-11 10:33:00
45
转载 js 原型继承
1.遵循基本原则:a.所有数据都是对象 b.要的到一个对象,不是实例化一个类,而是找到其原型并clone他 。 c.原型会记住对象。 d.如果对象无法相应某个请求,那么就会把这个请求委托给自己的原型。2.函数的参数对象转换为数组:arguments => array Array.prototype.slice(arguments);arguments是一个类数组并...
2019-03-11 09:59:00
81
转载 vue 动画
一般动画配合v-if v-else 或则v-show 来实现,所有将要有动画效果的元素都包含在一个transition的组件中。在该组件中,每个动画元素都包含6个阶段:1.v-enter2.v-enter-active3.v-enter-to4.v-leave5.v-leave-active6.v-leave-to在v-enter-active和v-le...
2019-02-19 09:33:00
140
转载 vuex学习心得
1.npm install vuex --save (生产环境会用到,因为--save)2.在src目录下建立store文件夹以及index.js文件。import Vue from 'vue';import Vuex from 'vuex';Vue.use(Vuex);const state = { showFooter:true, ...
2019-02-18 17:54:00
168
转载 vue+elementui dropdown 下拉菜单绑定方法
方法一:给el-dropdown根组件监听command ,再el-dropdown-item 绑定commandshuxing值。 methods内详细写监听对应的方法handleCommand(command) {if(command == 'loginOut'){this.$confirm('are you sure loginOut?', '提示', {con...
2019-02-18 11:19:00
3072
转载 vue 生命周期一点学习
再 vue中生命周期一般包含:beforeCreate,created,beforeMount,mounted,beforeUpdate,updated,beforeDestory,destoried。在每个阶段我们可以做相应的事,因为在不同的阶段我们的vue对象的某些属性并未生成或则更新。比如再beforeCreate阶段我们就可以进行loading等前面准备的事,create...
2019-02-11 16:32:00
89
转载 layui selec下的option出现之前的渲染
$(document).on('click', 'select+', function(){ // 被点击的 var elem = $(this); // 原始的select节点 var selectElem = elem.prev(); if($(".layui-form-select").hasClass("layui-form-selected")){...
2019-01-02 17:17:00
152
转载 事件执行顺序
mousedown > mouseup > clickblur > click转载于:https://www.cnblogs.com/tutao1995/p/10178232.html
2018-12-26 11:35:00
179
转载 文件格式化
/*文件大小转换*/gg.core.getFileSize = function (appByts) { let mb = 1024 * 1024; if (appByts > mb) { let bb = appByts / (1024 * 1024); bb = bb.toFixed(2); return bb + "M";...
2018-12-07 11:21:00
98
转载 日期
日期前一周的时间显示://时间格式化function timeFormat() { var date = new Date(), y = date.getFullYear(), m = date.getMonth() + 1, d = date.getDate(), nowDate = y + "-" + m + "-" + d; return nowD...
2018-11-23 15:41:00
68
转载 js 技巧
想要某个函数只在开始的时候执行一次,对数据进行了增删改查,同时也都调用了该方法,但结果也只是只是第一的结果,可在全局设置一个变量,var first = true;if(first){function;first = false}转载于:https://www.cnblogs.com/tutao1995/p/9983204.html...
2018-11-19 15:08:00
126
转载 监听屏幕触摸
https://www.cnblogs.com/winyh/p/6714923.html转载于:https://www.cnblogs.com/tutao1995/p/9969910.html
2018-11-16 16:08:00
65
转载 监听鼠标滚轮事件
js://兼容性写法,该函数也是网上别人写的,不过找不到出处了,蛮好的,所有我也没有必要修改了//判断鼠标滚轮滚动方向if (window.addEventListener)//FF,火狐浏览器会识别该方法 window.addEventListener('DOMMouseScroll', wheel, false);window.onmousewheel = ...
2018-11-16 16:05:00
474
转载 页面加载前执行函数
window.onpageshow = function(){ var token = gg.core.cookie.getValue("token"); console.log(token); if(token == ""||token == null){ window.location = 'login.html'; return; ...
2018-10-30 17:36:00
1239
转载 session方法
h5新特性--WebStorage <值得收藏>localStorage 在客户端浏览器(永久保存)保存数据保存数据 localStorage[key] = value保存数据 localStorage.setItem(key,value);获取数据 var value = localStorage [key];获取数据 var value = local...
2018-10-30 16:20:00
236
转载 laydate无法2次刷新渲染
那就将该dom元素删除,在重新动态添加转载于:https://www.cnblogs.com/tutao1995/p/9857013.html
2018-10-26 16:12:00
899
转载 加密登录
处理机制如下:1、客户端从服务端请求一个RSA公钥(ta/admin/encrypt?generateKeyPair=true)2、客户端产生一个随机数作为AES密钥,用RSA公钥进行加密,发送到服务端(ta/admin/encrypt?handshake=true),其中aes密钥用属性key传递3、服务端用RSA私钥进行解密,同时将AES密钥保持到会话中4、服务端用A...
2018-10-25 15:00:00
186
转载 页面位置
// 定位父级offsetParent的定义是:与当前元素最近的经过定位(position不等于static)的父级元素// 偏移量:offsetTop,offsetHeight,offsetWidth,offsetLeft// offsetTop表示元素的上外边框至offsetParent元素的上内边框之间的像素距离// 偏移:offsetWidth = widt...
2018-10-23 17:51:00
121
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人