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
yuche committed Oct 22, 2018
2 parents 8e493b9 + 69ed1cb commit f0facec
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 23 deletions.
35 changes: 21 additions & 14 deletions PLANS.md
@@ -1,18 +1,25 @@
# 开发计划
# 版本计划

## 正在进行
### 1.1.0

- [x] TypeScript 支持
- [x] 第三方组件引用支持
- [x] 小程序组件化重构
- [x] 第三方 UI 库支持
- [x] 小程序性能优化
- [ ] RN适配开发中,预计 9 月初完成
- [ ] 快应用适配支持
- [ ] 小程序代码转 Taro 代码
> 预计 10 月底
## 即将开始
- [x] 百度小程序转换支持
- [x] 支付宝小程序转换支持
- [ ] Taro 组件在小程序端原生使用规范
- [ ] UI 库打包能力开放

- [ ] 小程序编译支持 Tree Shaking
- [ ] 支持 CSS Modules
- [ ] 支持 Styled Components
### 1.2.0

> 预计 11 月初
- [ ] 小程序代码转 Taro
- [ ] CSS Modules 支持

### 1.3.0

> 预计 11 月底
- [ ] 快应用转换支持
- [ ] Taro Doctor
- [ ] 多端同时编译
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -33,7 +33,7 @@ Taro 已经投入了我们的生产环境中使用,业界也在广泛地使用
* [Taro整合Dva示例](https://github.com/zuoge85/taro-dva)
* [V2ex小程序(TypeScript)](https://github.com/NervJS/taro-v2ex)
* [与微信小程序原生融合的示例](https://github.com/NervJS/taro-sample-weapp)
* [基于Taro + Dva构建的时装衣橱(电商实战项目)](https://github.com/EasyTuan/taro-msparis)
* 💯[基于Taro + Dva构建的时装衣橱(电商实战项目)](https://github.com/EasyTuan/taro-msparis)

## 文章教程

Expand Down
12 changes: 9 additions & 3 deletions packages/taro-alipay/src/native-api.js
Expand Up @@ -239,13 +239,16 @@ function processApis (taro) {
const weApis = Object.assign({ }, onAndSyncApis, noPromiseApis, otherApis)
Object.keys(weApis).forEach(key => {
if (!onAndSyncApis[key] && !noPromiseApis[key]) {
taro[key] = options => {
taro[key] = (options, ...args) => {
const result = generateSpecialApis(key, options || {})
key = result.api
options = result.options
let task = null
let obj = Object.assign({}, options)
if (typeof options === 'string') {
if (args.length) {
return my[key](options, ...args)
}
return my[key](options)
}
const p = new Promise((resolve, reject) => {
Expand All @@ -272,8 +275,11 @@ function processApis (taro) {
}
}
})

task = my[key](obj)
if (args.length) {
task = my[key](obj, ...args)
} else {
task = my[key](obj)
}
})
if (key === 'uploadFile' || key === 'downloadFile') {
p.progress = cb => {
Expand Down
6 changes: 5 additions & 1 deletion packages/taro-cli/src/h5.js
Expand Up @@ -290,7 +290,11 @@ function processEntry (code, filePath) {
})
if (root === null) return
subPages.forEach(va => {
pages.push(`${root}${va}`)
let pagePath = `${root}/${va}`
pagePath = pagePath.replace(/\/{2,}/g, '/')
if (pages.indexOf(pagePath) < 0) {
pages.push(pagePath)
}
})
})
} else if (keyName === 'tabBar' && t.isObjectExpression(value)) {
Expand Down
11 changes: 9 additions & 2 deletions packages/taro-swan/src/native-api.js
Expand Up @@ -66,7 +66,7 @@ function processApis (taro) {
const weApis = Object.assign({ }, onAndSyncApis, noPromiseApis, otherApis)
Object.keys(weApis).forEach(key => {
if (!onAndSyncApis[key] && !noPromiseApis[key]) {
taro[key] = options => {
taro[key] = (options, ...args) => {
options = options || {}
if (key === 'connectSocket') {
if (options['protocols']) {
Expand All @@ -76,6 +76,9 @@ function processApis (taro) {
let task = null
let obj = Object.assign({}, options)
if (typeof options === 'string') {
if (args.length) {
return swan[key](options, ...args)
}
return swan[key](options)
}
const p = new Promise((resolve, reject) => {
Expand All @@ -94,7 +97,11 @@ function processApis (taro) {
}
}
})
task = swan[key](obj)
if (args.length) {
task = swan[key](obj, ...args)
} else {
task = swan[key](obj)
}
})
if (key === 'uploadFile' || key === 'downloadFile') {
p.progress = cb => {
Expand Down
2 changes: 2 additions & 0 deletions packages/taro-weapp/src/component.js
Expand Up @@ -21,6 +21,7 @@ class BaseComponent {
nextProps = {}
_dirty = true
_disable = true
_isForceUpdate = false
_pendingStates = []
_pendingCallbacks = []
$router = {
Expand Down Expand Up @@ -71,6 +72,7 @@ class BaseComponent {
if (isFunction(callback)) {
(this._pendingCallbacks = this._pendingCallbacks || []).push(callback)
}
this._isForceUpdate = true
updateComponent(this)
}

Expand Down
2 changes: 2 additions & 0 deletions packages/taro-weapp/src/lifecycle.js
Expand Up @@ -35,6 +35,7 @@ export function updateComponent (component) {
let skip = false
if (component.__mounted) {
if (typeof component.shouldComponentUpdate === 'function' &&
!component._isForceUpdate &&
component.shouldComponentUpdate(props, state) === false) {
skip = true
} else if (typeof component.componentWillUpdate === 'function') {
Expand All @@ -44,6 +45,7 @@ export function updateComponent (component) {
component.props = props
component.state = state
component._dirty = false
component._isForceUpdate = false
if (!component.__componentWillMountTriggered) {
component.__componentWillMountTriggered = true
componentTrigger(component, 'componentWillMount')
Expand Down
11 changes: 9 additions & 2 deletions packages/taro-weapp/src/native-api.js
Expand Up @@ -75,11 +75,14 @@ function processApis (taro) {
const preloadInitedComponent = '$preloadComponent'
Object.keys(weApis).forEach(key => {
if (!onAndSyncApis[key] && !noPromiseApis[key]) {
taro[key] = options => {
taro[key] = (options, ...args) => {
options = options || {}
let task = null
let obj = Object.assign({}, options)
if (typeof options === 'string') {
if (args.length) {
return wx[key](options, ...args)
}
return wx[key](options)
}

Expand Down Expand Up @@ -121,7 +124,11 @@ function processApis (taro) {
}
}
})
task = wx[key](obj)
if (args.length) {
task = wx[key](obj, ...args)
} else {
task = wx[key](obj)
}
})
if (key === 'uploadFile' || key === 'downloadFile') {
p.progress = cb => {
Expand Down

0 comments on commit f0facec

Please sign in to comment.