Skip to content

Commit

Permalink
Merge branch 'master' of github.com:NervJS/taro
Browse files Browse the repository at this point in the history
  • Loading branch information
Pines-Cheng committed Apr 19, 2019
2 parents c10d785 + ced8b11 commit 0d80849
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ class App extends Component {
| - | - | - | - |
| pagePath | String || 页面路径,必须在 pages 中先定义 |
| text | String || tab 上按钮文字 |
| iconPath | String || 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。<br/>当 postion 为 top 时,不显示 icon。 |
| selectedIconPath | String || 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。<br/>当 postion 为 top 时,不显示 icon。 |
| iconPath | String || 图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。<br/>当 position 为 top 时,不显示 icon。 |
| selectedIconPath | String || 选中时的图片路径,icon 大小限制为40kb,建议尺寸为 81px * 81px,不支持网络图片。<br/>当 position 为 top 时,不显示 icon。 |

#### networkTimeout

Expand Down
4 changes: 4 additions & 0 deletions packages/taro-components/src/components/video/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* Video组件的样式参考了[uni-app](https://github.com/dcloudio/uni-app/tree/master/packages/uni-h5)的实现
*/

import Nerv, { Component, createPortal } from 'nervjs'
import classnames from 'classnames'
import Danmu from './danmu'
Expand Down
21 changes: 21 additions & 0 deletions packages/taro-h5/__test__/createAnimation-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable */
import { createAnimation } from '../src/api/createAnimation'

describe('createAnimation', () => {
it('test unit', () => {
const ani = createAnimation()
const { rules, transform } = ani
ani.left(10)
expect(rules[0]).toEqual(`left: 10px`)
ani.top('10')
expect(rules[1]).toEqual(`top: 10px`)
ani.right('10%')
expect(rules[2]).toEqual(`right: 10%`)
ani.translate(10, '10%')
expect(transform[1]).toEqual(`translate(10px, 10%)`)
ani.translateX('10')
expect(transform[2]).toEqual(`translateX(10px)`)
ani.translate3d('10', 10, '20%')
expect(transform[3]).toEqual(`translate3d(10px, 10px, 20%)`)
})
})
2 changes: 1 addition & 1 deletion packages/taro-h5/src/api/audio/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import { findRef } from '../utils/index'
import { createCallbackManager } from '../utils/index'
import Taro from '@tarojs/taro-h5'
import Taro from '../../taro'

/**
* @typedef {object} InnerAudioContext
Expand Down
7 changes: 7 additions & 0 deletions packages/taro-h5/src/api/clipboard/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/**
* 剪贴板部分的api参考了Chameleon项目的实现:
*
* setClipboardData: https://github.com/chameleon-team/chameleon-api/tree/master/src/interfaces/setClipBoardData
* getClipboardData: https://github.com/chameleon-team/chameleon-api/tree/master/src/interfaces/getClipBoardData
*/

import { setStorage, getStorage } from '../storage/index'

const CLIPBOARD_STORAGE_NAME = 'taro_clipboard'
Expand Down
42 changes: 31 additions & 11 deletions packages/taro-h5/src/api/createAnimation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ class Animation {
}
})
}
transformUnit (...args) {
const ret = []
args.forEach(each => {
ret.push(isNaN(each) ? each : `${each}${this.unit}`)
})
return ret
}
// 设置默认值
setDefault (duration, delay, timingFunction, transformOrigin) {
this.DEFAULT = { duration, delay, timingFunction, transformOrigin }
Expand Down Expand Up @@ -179,23 +186,30 @@ class Animation {
return this
}
translate (x, y) {
this.transform.push(`translate(${x}${this.unit}, ${y}${this.unit})`)
[x, y] = this.transformUnit(x, y)
this.transform.push(`translate(${x}, ${y})`)
return this
}
translate3d (x, y, z) {
this.transform.push(`translate3d(${x}${this.unit}, ${y}${this.unit}, ${z}${this.unit})`)
[x, y, z] = this.transformUnit(x, y, z)
this.transform.push(
`translate3d(${x}, ${y}, ${z})`
)
return this
}
translateX (translate) {
this.transform.push(`translateX(${translate}${this.unit})`)
[translate] = this.transformUnit(translate)
this.transform.push(`translateX(${translate})`)
return this
}
translateY (translate) {
this.transform.push(`translateY(${translate}${this.unit})`)
[translate] = this.transformUnit(translate)
this.transform.push(`translateY(${translate})`)
return this
}
translateZ (translate) {
this.transform.push(`translateZ(${translate}${this.unit})`)
[translate] = this.transformUnit(translate)
this.transform.push(`translateZ(${translate})`)
return this
}
opacity (value) {
Expand All @@ -207,27 +221,33 @@ class Animation {
return this
}
width (value) {
this.rules.push(`width: ${value}${this.unit}`)
[value] = this.transformUnit(value)
this.rules.push(`width: ${value}`)
return this
}
height (value) {
this.rules.push(`height: ${value}${this.unit}`)
[value] = this.transformUnit(value)
this.rules.push(`height: ${value}`)
return this
}
top (value) {
this.rules.push(`top: ${value}${this.unit}`)
[value] = this.transformUnit(value)
this.rules.push(`top: ${value}`)
return this
}
right (value) {
this.rules.push(`right: ${value}${this.unit}`)
[value] = this.transformUnit(value)
this.rules.push(`right: ${value}`)
return this
}
bottom (value) {
this.rules.push(`bottom: ${value}${this.unit}`)
[value] = this.transformUnit(value)
this.rules.push(`bottom: ${value}`)
return this
}
left (value) {
this.rules.push(`left: ${value}${this.unit}`)
[value] = this.transformUnit(value)
this.rules.push(`left: ${value}`)
return this
}
// 关键帧载入
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-h5/src/api/unsupportedApi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const getConnectedWifi = temporarilyNotSupport('getConnectedWifi')
// export const showModal = temporarilyNotSupport('showModal')
// export const showActionSheet = temporarilyNotSupport('showActionSheet')
// export const setNavigationBarTitle = temporarilyNotSupport('setNavigationBarTitle')
export const setNavigationBarColor = temporarilyNotSupport('setNavigationBarColor')
// export const setNavigationBarColor = temporarilyNotSupport('setNavigationBarColor')
// export const setTabBarBadge = temporarilyNotSupport('setTabBarBadge')
// export const removeTabBarBadge = temporarilyNotSupport('removeTabBarBadge')
// export const showTabBarRedDot = temporarilyNotSupport('showTabBarRedDot')
Expand Down
6 changes: 3 additions & 3 deletions packages/taro-h5/src/taro/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
/* eslint-disable-next-line camelcase */
internal_safe_set,
render,
intercepters
interceptors
} from '@tarojs/taro'
import Nerv from 'nervjs'

Expand Down Expand Up @@ -107,7 +107,7 @@ taro.requirePlugin = requirePlugin
taro.getApp = getApp
taro.pxTransform = pxTransform
taro.canIUseWebp = canIUseWebp
taro.intercepters = intercepters
taro.interceptors = interceptors

export default taro
export {
Expand All @@ -116,7 +116,7 @@ export {
Events,
eventCenter,
render,
intercepters,
interceptors,
/* eslint-disable-next-line camelcase */
internal_safe_set,
/* eslint-disable-next-line camelcase */
Expand Down

0 comments on commit 0d80849

Please sign in to comment.