mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 12:07:39 +08:00
update flow annotations
This commit is contained in:
parent
2732fec59e
commit
e6871a33c1
@ -14,7 +14,6 @@ declare interface Component {
|
|||||||
// assets
|
// assets
|
||||||
static directive: (id: string, def?: Function | Object) => Function | Object | void;
|
static directive: (id: string, def?: Function | Object) => Function | Object | void;
|
||||||
static component: (id: string, def?: Class<Component> | Object) => Class<Component>;
|
static component: (id: string, def?: Class<Component> | Object) => Class<Component>;
|
||||||
static transition: (id: string, def?: Object) => Object | void;
|
|
||||||
static filter: (id: string, def?: Function) => Function | void;
|
static filter: (id: string, def?: Function) => Function | void;
|
||||||
|
|
||||||
// public properties
|
// public properties
|
||||||
|
@ -14,7 +14,6 @@ declare interface GlobalAPI {
|
|||||||
|
|
||||||
directive: (id: string, def?: Function | Object) => Function | Object | void;
|
directive: (id: string, def?: Function | Object) => Function | Object | void;
|
||||||
component: (id: string, def?: Class<Component> | Object) => Class<Component>;
|
component: (id: string, def?: Class<Component> | Object) => Class<Component>;
|
||||||
transition: (id: string, def?: Object) => Object | void;
|
|
||||||
filter: (id: string, def?: Function) => Function | void;
|
filter: (id: string, def?: Function) => Function | void;
|
||||||
|
|
||||||
// allow dynamic method registration
|
// allow dynamic method registration
|
||||||
|
@ -56,7 +56,7 @@ declare type ComponentOptions = {
|
|||||||
_isComponent?: true,
|
_isComponent?: true,
|
||||||
_propKeys?: Array<string>,
|
_propKeys?: Array<string>,
|
||||||
_parentVnode?: VNode,
|
_parentVnode?: VNode,
|
||||||
_parentListeners?: ?{ [key: string]: Function | Array<Function> },
|
_parentListeners?: ?Object,
|
||||||
_renderChildren?: ?VNodeChildren
|
_renderChildren?: ?VNodeChildren
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ declare interface VNodeData {
|
|||||||
staticAttrs?: { [key: string]: string };
|
staticAttrs?: { [key: string]: string };
|
||||||
hook?: { [key: string]: Function };
|
hook?: { [key: string]: Function };
|
||||||
on?: { [key: string]: Function | Array<Function> };
|
on?: { [key: string]: Function | Array<Function> };
|
||||||
transition?: string | Object;
|
transition?: Object;
|
||||||
inlineTemplate?: {
|
inlineTemplate?: {
|
||||||
render: Function,
|
render: Function,
|
||||||
staticRenderFns: Array<Function>
|
staticRenderFns: Array<Function>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* @flow */
|
||||||
|
|
||||||
// Provides transition support for list items.
|
// Provides transition support for list items.
|
||||||
// supports move transitions using the FLIP technique.
|
// supports move transitions using the FLIP technique.
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ delete props.mode
|
|||||||
export default {
|
export default {
|
||||||
props,
|
props,
|
||||||
|
|
||||||
render (h) {
|
render (h: Function) {
|
||||||
const tag = this.tag || this.$vnode.data.tag || 'span'
|
const tag = this.tag || this.$vnode.data.tag || 'span'
|
||||||
const map = Object.create(null)
|
const map = Object.create(null)
|
||||||
const prevChildren = this.prevChildren = this.children
|
const prevChildren = this.prevChildren = this.children
|
||||||
@ -127,7 +129,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
hasMove (el, moveClass) {
|
hasMove (el: Element, moveClass: string): boolean {
|
||||||
/* istanbul ignore if */
|
/* istanbul ignore if */
|
||||||
if (!hasTransition) {
|
if (!hasTransition) {
|
||||||
return false
|
return false
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
/* @flow */
|
||||||
|
|
||||||
// Provides transition support for a single element/component.
|
// Provides transition support for a single element/component.
|
||||||
// supports transition mode (out-in / in-out)
|
// supports transition mode (out-in / in-out)
|
||||||
|
|
||||||
@ -18,7 +20,7 @@ export const transitionProps = {
|
|||||||
appearActiveClass: String
|
appearActiveClass: String
|
||||||
}
|
}
|
||||||
|
|
||||||
export function extractTransitionData (comp) {
|
export function extractTransitionData (comp: Component): Object {
|
||||||
const data = {}
|
const data = {}
|
||||||
const options = comp.$options
|
const options = comp.$options
|
||||||
// props
|
// props
|
||||||
@ -38,7 +40,7 @@ export default {
|
|||||||
name: 'transition',
|
name: 'transition',
|
||||||
props: transitionProps,
|
props: transitionProps,
|
||||||
_abstract: true,
|
_abstract: true,
|
||||||
render (h) {
|
render (h: Function) {
|
||||||
let children = this.$slots.default
|
let children = this.$slots.default
|
||||||
if (!children) {
|
if (!children) {
|
||||||
return
|
return
|
||||||
@ -91,10 +93,11 @@ export default {
|
|||||||
// apply transition data to child
|
// apply transition data to child
|
||||||
// use getRealChild() to ignore abstract components e.g. keep-alive
|
// use getRealChild() to ignore abstract components e.g. keep-alive
|
||||||
const child = getRealChild(rawChild)
|
const child = getRealChild(rawChild)
|
||||||
|
if (!child) return
|
||||||
child.key = child.key || `__v${child.tag + this._uid}__`
|
child.key = child.key || `__v${child.tag + this._uid}__`
|
||||||
const data = (child.data || (child.data = {})).transition = extractTransitionData(this)
|
const data = (child.data || (child.data = {})).transition = extractTransitionData(this)
|
||||||
const oldRawChild = this._vnode
|
const oldRawChild = this._vnode
|
||||||
const oldChild = getRealChild(oldRawChild)
|
const oldChild: any = getRealChild(oldRawChild)
|
||||||
|
|
||||||
// handle transition mode
|
// handle transition mode
|
||||||
if (mode && oldChild && oldChild.data && oldChild.key !== child.key) {
|
if (mode && oldChild && oldChild.data && oldChild.key !== child.key) {
|
||||||
|
Loading…
Reference in New Issue
Block a user