weui / react-weui

weui for react
https://weui.github.io/react-weui/docs/
2.85k stars 492 forks source link

Uploader组件在IOS上无法选择照片,直接打开了相机 #251

Closed lifeipengdev closed 7 years ago

lifeipengdev commented 7 years ago

bug

Uploader组件在IOS上无法选择照片,直接打开了相机,在Android上正常

应该同时要支持ios/android

使用的版本如下 "react": "^15.6.1", "react-weui": "^1.1.3", "weixin-js-sdk": "^1.2.0", "weui": "^1.1.0"

IOS手机为10.3.2 微信版本是6.5.12

n7best commented 7 years ago

@lifeipengdev 这个是ios 10.3.1之后对Input做的修改 可以试下在给uploader加上capture={false}这个属性

lifeipengdev commented 7 years ago

已经解决了,感谢答复

componentDidMount() { let platform = window.navigator.platform; let inputs = document.getElementsByClassName('weui-uploader__input')[0]; if(platform === 'iPhone') { inputs.removeAttribute('capture'); } }

n7best commented 7 years ago

i think you could do something like

<Uploader capture={ !(window.navigator.platform === 'iPhone') } />
youngjuning commented 6 years ago

为什么不更新文档啊,大哥们