jsweber
jsweber
web前端开发,4年经验,vue和react都可以,同求
You can use my solution **step one**:copy this code as a javascript file mergeRouterGuard.js ``` javascript export const NeedMergeGuards = ['beforeRouteEnter', 'beforeRouteUpdate', 'beforeRouteLeave'] export function mergeFuncUtil (nextHook, prevHook) { return...
```js 第一题:'1' 第二题: '2' 第二题: '0.04' 第四题: '0.04' /chrome;'0.05'/ie 第五题: Number.prototype.toFixed = function(n){ n = parseInt(n) if (n < 0) return NaN let num = this.valueOf() let numStr = num...
```js const myRand = ( seed ) => { seed = ( seed * 9301 + 49297 ) % 233280 return seed / ( 233280.0 ) * 10e17 } const...
[demo](https://codepen.io/jsweber/pen/PrORPa) ```css body{ margin: 0 } .btn-wrapper{ display: flex; flex-wrap: nowrap; background: #eee; padding: 10px 0; } .btn { outline: none; border: 1px solid #ef7b82; color: #ef7b82; padding: 6px 0;...
```js if (!Element.prototype.matches) Element.prototype.matches = webkitMatchesSelector || msMatchesSelector || mozMatchesSelector if (!Element.prototype.closest){ Element.prototype.closest = function(s){ if (!document.documentElement.contains(this)) return null let cur = this do{ if (cur.matches(s)) return cur cur =...
```js document.cookie //第一题 document.cookie="userid=1" //第二题 //第三题 let time=+new Date(); document.cookie=`userid=1;expires=${new Date(time+24*60*60*1000).toUTCString()}` //第四题 const getCsrfToken = () => { let key = '_csrfToken' let cookie = document.cookie let start = cookie.indexOf(key)...
[online demo](http://js.jirengu.com/bocoy/1/edit) ```js //第一题 let div = document.createElement('div') div.style.cssText = 'width:300px;height:150px;color:#fff;' div.innerText = 'hover to change' document.body.appendChild(div) //第二题 div.style.backgroundImage = 'linear-gradient(to bottom right, red, blue)' //第三题 div.addEventListener('mouseenter', () => {...
[在线演示](https://jsbin.com/zuyosur/3/edit?html,css,output) ```html 提案笙 9月30日 21:47 什么秘密,我觉得你现在跟我说什么都没有意义 淮南王铃 10月8日10:30 @蝴蝶蓝优秀 蝴蝶蓝 昨天22:13 值得一听~~ 刚刚 Y优秀X 围观戏精现场 ``` ```css ul,li,div,span{ margin:0; padding:0; } .clearfix{} .clearfix::after{ content: ''; display: block; clear: both; }...
[在线案例](http://js.jirengu.com/wavoz/1/edit) 多了一个选框的效果 ```js const BoxName = 'box' const Time = 350 //第一题 添加20个box const appendBox = (num=1) => { let fragment = document.createDocumentFragment() for (let i = 0; i <...