This file contains 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 = function (grunt) { | |
grunt.loadNpmTasks('assemble-less'); | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
less: { | |
compileCore: { | |
options: { |
This file contains 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
var sUserAgent = navigator.userAgent.toLowerCase(); | |
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; | |
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; | |
var bIsMidp = sUserAgent.match(/midp/i) == "midp"; | |
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; | |
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; | |
var bIsAndroid = sUserAgent.match(/android/i) == "android"; | |
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; | |
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; |
This file contains 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
{ | |
"scripts": { | |
"dev": "webpack-dev-server --devtool eval --hot --progress --colors --content-base dist --port 3000" | |
} | |
} |
This file contains 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
# Automatically normalize line endings for all text-based files | |
# http://git-scm.com/docs/gitattributes#_end_of_line_conversion | |
* text=auto | |
# For the following file types, normalize line endings to LF on | |
# checkin and prevent conversion to CRLF when they are checked out | |
# (this is required in order to prevent newline related issues like, | |
# for example, after the build script is run) | |
.* text eol=lf | |
*.css text eol=lf |
This file contains 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 default { | |
props: { | |
value: { | |
type: [String, Number], | |
default: '', | |
}, | |
}, | |
data() { |
This file contains 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
import crypto from 'crypto' | |
const genRandomString = (length) => { | |
return crypto.randomBytes(Math.ceil(length / 2)) | |
.toString('hex') | |
.slice(0, length) | |
} | |
const sha512 = (password, salt) => { | |
const hash = crypto.createHmac('sha512', salt) |
This file contains 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 useReducer(reducer, initialState, initialAction) { | |
currentlyRenderingFiber$1 = resolveCurrentlyRenderingFiber(); | |
workInProgressHook = createWorkInProgressHook(); | |
var queue = workInProgressHook.queue; | |
if (queue !== null) { | |
// Already have a queue, so this is an update. | |
if (isReRender) { | |
// This is a re-render. Apply the new render phase updates to the previous | |
var _dispatch2 = queue.dispatch; | |
if (renderPhaseUpdates !== null) { |
This file contains 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 finishHooks(Component, props, children, refOrContext) { | |
// This must be called after every function component to prevent hooks from | |
// being used in classes. | |
while (didScheduleRenderPhaseUpdate) { | |
// Updates were scheduled during the render phase. They are stored in | |
// the `renderPhaseUpdates` map. Call the component again, reusing the | |
// work-in-progress hooks and applying the additional updates on top. Keep | |
// restarting until no more updates are scheduled. | |
didScheduleRenderPhaseUpdate = false; |
This file contains 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
type BaseFiberRootProperties = {| | |
// root节点,render方法接收的第二个参数 | |
containerInfo: any, | |
// 只有在持久更新中会用到,也就是不支持增量更新的平台,react-dom不会用到 | |
pendingChildren: any, | |
// 当前应用对应的Fiber对象,是Root Fiber | |
current: Fiber, | |
// 一下的优先级是用来区分 | |
// 1) 没有提交(committed)的任务 |
This file contains 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
// Fiber对应一个组件需要被处理或者已经处理了,一个组件可以有一个或者多个Fiber | |
type Fiber = {| | |
// 标记不同的组件类型 | |
tag: WorkTag, | |
// ReactElement里面的key | |
key: null | string, | |
// ReactElement.type,也就是我们调用`createElement`的第一个参数 | |
elementType: any, |
OlderNewer