提交 6a925a7d 编写于 作者: X xiaoyucoding

Merge branch 'master' into dev

import { fileToUrl } from 'uni-platform/helpers/file'
import { updateElementStyle } from 'uni-shared'
const {
invokeCallbackHandler: invoke
......@@ -9,7 +10,14 @@ let imageInput = null
const _createInput = function (options) {
let inputEl = document.createElement('input')
inputEl.type = 'file'
inputEl.style = 'position: absolute;visibility: hidden;z-index: -999;width: 0;height: 0;'
updateElementStyle(inputEl, {
'position': 'absolute',
'visibility': 'hidden',
'z-index': -999,
'width': 0,
'height': 0
})
// inputEl.style = 'position: absolute;visibility: hidden;z-index: -999;width: 0;height: 0;'
inputEl.accept = 'image/*'
if (options.count > 1) {
inputEl.multiple = 'multiple'
......
import { fileToUrl } from 'uni-platform/helpers/file'
import { updateElementStyle } from 'uni-shared'
const {
invokeCallbackHandler: invoke
......@@ -9,7 +10,14 @@ let videoInput = null
const _createInput = function (options) {
let inputEl = document.createElement('input')
inputEl.type = 'file'
inputEl.style = 'position: absolute;visibility: hidden;z-index: -999;width: 0;height: 0;'
updateElementStyle(inputEl, {
'position': 'absolute',
'visibility': 'hidden',
'z-index': -999,
'width': 0,
'height': 0
})
// inputEl.style = 'position: absolute;visibility: hidden;z-index: -999;width: 0;height: 0;'
inputEl.accept = 'video/*'
// 经过测试,仅能限制只通过相机拍摄,不能限制只允许从相册选择。
if (options.sourceType.length === 1 && options.sourceType[0] === 'camera') {
......
......@@ -50,3 +50,9 @@ export function formatDateTime ({
return date.getFullYear() + '-' + _completeValue(date.getMonth() + 1) + '-' + _completeValue(date.getDate())
}
}
export function updateElementStyle (element, styles) {
for (let attrName in styles) {
element.style[attrName] = styles[attrName]
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册