This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function generateRandomPassword() { | |
| const randomChar = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
| const randomNum = '0123456789' | |
| const randomSymbol = '!@#$%^&*()' | |
| const getRandomChar = () => randomChar[Math.floor(Math.random() * randomChar.length)] | |
| const getRandomNum = () => randomNum[Math.floor(Math.random() * randomNum.length)] | |
| const getRandomSymbol = () => randomSymbol[Math.floor(Math.random() * randomSymbol.length)] | |
| const passwordLength = 8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const getUserInfo = (function() { | |
| let userInfo = null | |
| let promise = null | |
| return function(cb) { | |
| if (!userInfo && !promise) { | |
| promise = new Promise(resolve => { | |
| setTimeout(() => { | |
| userInfo = {username: 'littledian'} | |
| resolve() | |
| cb && cb(userInfo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Set { | |
| static _next = 0 | |
| constructor (...args) { | |
| this.values = {} | |
| this.n = 0 | |
| this.add.apply(this, args) | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function inherit (p) { | |
| if (p == null) throw new TypeError() | |
| if (Object.create) return Object.create(p) | |
| const t = typeof p | |
| if (t !== 'object' && t !== 'function') throw new TypeError() | |
| function f () {} | |
| f.prototype = p |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $element-separator: '__'; | |
| $modifier-separator: '--'; | |
| $state-prefix: 'is-'; | |
| @function selectorToString($selector) { | |
| $selector: inspect($selector); | |
| $selector: str-slice($selector, 2, -2); | |
| @return $selector; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module.exports = { | |
| configureWebpack: config => { | |
| if (process.env.NODE_ENV === 'development') { | |
| config.devtool = 'eval-source-map' | |
| } | |
| config.output.devtoolModuleFilenameTemplate = info => { | |
| let $filename = 'sources://' + info.resourcePath | |
| if (info.resourcePath.match(/\.vue$/) && !info.identifier.match(/type=script/)) { | |
| $filename = 'webpack-generated:///' + info.identifier + '?' + info.hash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function drag ( | |
| { | |
| mouseDownEvent, | |
| element, | |
| once = false, | |
| mouseDownCallback = () => {}, | |
| mouseMoveCallback = () => {}, | |
| mouseUpCallback = () => {} | |
| }) { | |
| if (!mouseDownEvent && !element) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| createForeignObjectSVG = ( | |
| width: number, | |
| height: number, | |
| x: number, | |
| y: number, | |
| node: Node | |
| ) => { | |
| const xmlns = 'http://www.w3.org/2000/svg'; | |
| const svg = document.createElementNS(xmlns, 'svg'); | |
| const foreignObject = document.createElementNS(xmlns, 'foreignObject'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Client = require('ssh2').Client | |
| const fs = require('fs') | |
| const path = require('path') | |
| function downloadFile (source, target, option) { | |
| return new Promise((resolve, reject) => { | |
| const conn = new Client() | |
| conn.on('ready', () => { | |
| conn.sftp((err, sftp) => { | |
| if (err) return reject(err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path') | |
| const PrerenderSPAPlugin = require('prerender-spa-plugin') | |
| const Renderer = PrerenderSPAPlugin.PuppeteerRenderer | |
| module.exports = { | |
| configureWebpack: config => { | |
| if (process.env.NODE_ENV === 'production') { | |
| // 为生产环境修改配置... | |
| config.plugins.push( | |
| new PrerenderSPAPlugin({ |
OlderNewer