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
const CompB = { | |
setup(props) { | |
const handleChange = (e) => { | |
props.value.name = e.target.value | |
props.onChange(props.value) | |
} | |
return () => { | |
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
const props: WhatType = { | |
a: { | |
type: Object as PropType<MyInterface> | |
} | |
} | |
const CompA = defineComponent({ | |
props: props, | |
setup(props) { | |
return () => <div>{props.a.name}</div> |
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(babel) { | |
const t = babel.types | |
const hookTest = /^use[A-Z]/ | |
let hooksImport = new Set() | |
return { | |
name: 'babel-plugin-transform-taro-hooks', | |
visitor: { |
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 Taro, { useEffect, useState, useRef } from '@tarojs/taro' | |
import * as tredux from '@tarojs/redux' | |
const env = Taro.getEnv() | |
const { WEB } = Taro.ENV_TYPE | |
let store | |
const refEquality = (a, b) => a === b |
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 function propagateContextChange( | |
workInProgress: Fiber, | |
context: ReactContext<mixed>, | |
changedBits: number, | |
renderExpirationTime: ExpirationTime, | |
): void { | |
let fiber = workInProgress.child; | |
if (fiber !== null) { | |
// Set the return pointer of the child to the work-in-progress fiber. | |
fiber.return = workInProgress; |
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 type Update<State> = { | |
// 更新的过期时间 | |
expirationTime: ExpirationTime, | |
// export const UpdateState = 0; | |
// export const ReplaceState = 1; | |
// export const ForceUpdate = 2; | |
// export const CaptureUpdate = 3; | |
// 指定更新的类型,值为以上几种 | |
tag: 0 | 1 | 2 | 3, |
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
/** | |
* Copyright (c) Facebook, Inc. and its affiliates. | |
* | |
* This source code is licensed under the MIT license found in the | |
* LICENSE file in the root directory of this source tree. | |
* | |
* @flow | |
*/ | |
export type SideEffectTag = number; |
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 const FunctionComponent = 0; | |
export const ClassComponent = 1; | |
export const IndeterminateComponent = 2; // Before we know whether it is function or class | |
export const HostRoot = 3; // Root of a host tree. Could be nested inside another node. | |
export const HostPortal = 4; // A subtree. Could be an entry point to a different renderer. | |
export const HostComponent = 5; | |
export const HostText = 6; | |
export const Fragment = 7; | |
export const Mode = 8; | |
export const ContextConsumer = 9; |
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
const input1 = `User { | |
id, | |
name, | |
age | |
}` | |
const input2 = `User( age:21 ){ | |
id, | |
name, | |
assigned Task( content: 'run' ): { |
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
const listeners = {} | |
// 不是很理解第三条。。。 | |
const bus = { | |
on(event, fun) { | |
let handler | |
let before | |
if (typeof fun === 'object' && fun.fn) { | |
handler = fun.fn |
NewerOlder