Skip to content

Commit

Permalink
feat: 将 zIndex 移入组件库内部 store
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Apr 17, 2019
1 parent 8a1ae20 commit 1c4bab4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/components/Popup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import MTransition from '../Transition'
import store from '../store'
import Taro from '@tarojs/taro'
import { CommonEventFunction } from '@tarojs/components/types/common'
import { component, RequiredProp } from '../component'
Expand Down Expand Up @@ -78,15 +79,12 @@ export default class MPopup extends component({
display: false as boolean,
},
}) {
/** 起始 zIndex 值 */
static startZIndex = 5000

/** 计数器 */
transitionEndCounter = 0

componentWillMount() {
this.setState({
zIndex: MPopup.startZIndex++,
zIndex: store.zIndex++,
display: this.props.visible,
})
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const store = {
zIndex: 5000,
}

export default store

0 comments on commit 1c4bab4

Please sign in to comment.