@marsjs/api
Advanced tools
Comparing version 1.0.22 to 1.0.23
@@ -7,7 +7,2 @@ /** | ||
import { | ||
chooseImage, | ||
previewImage | ||
} from './image'; | ||
import { | ||
uploadFile | ||
@@ -17,5 +12,3 @@ } from './upload'; | ||
export { | ||
chooseImage, | ||
previewImage, | ||
uploadFile | ||
}; |
@@ -7,5 +7,5 @@ /** | ||
import {callback} from '../../lib/utils'; | ||
import {callback, isIOS} from '../../lib/utils'; | ||
export function uploader(type = 'image', count = 1) { | ||
export function uploader(type = 'image', count = 1, sourceType) { | ||
return new Promise((resolve, reject) => { | ||
@@ -19,2 +19,6 @@ const input = document.getElementById('mars-uploader') || document.createElement('input'); | ||
input.style.height = 0; | ||
// iOS 下存在 capture 属性时,默认打开相机 | ||
if (type === 'image' && isIOS() && !sourceType.includes('album')) { | ||
input.capture = 'camera'; | ||
} | ||
@@ -60,3 +64,2 @@ document.body.appendChild(input); | ||
} | ||
}; | ||
@@ -72,12 +75,3 @@ | ||
export function uploadFile(options) { | ||
const { | ||
url, | ||
filePath, | ||
name, | ||
header = null, | ||
formData = null, | ||
success, | ||
fail, | ||
complete | ||
} = options; | ||
const {url, filePath, name, header = null, formData = null, success, fail, complete} = options; | ||
@@ -102,5 +96,4 @@ const rformData = new FormData(); | ||
} | ||
throw e; | ||
}); | ||
} |
@@ -29,3 +29,3 @@ /** | ||
/* eslint-disable */ | ||
in (component) { | ||
in(component) { | ||
this.$root = component.$el; | ||
@@ -55,3 +55,3 @@ return this; | ||
selectViewport() { | ||
this.$doms.push(this.$root.querySelector('html')); | ||
this.$doms.push(document.querySelector('html')); | ||
return this; | ||
@@ -58,0 +58,0 @@ } |
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.0.23](https://github.com/max-team/Mars/compare/@marsjs/api@1.0.22...@marsjs/api@1.0.23) (2019-07-17) | ||
### Features | ||
* **api:** support battery/clipboard/motion/part of media apis ([#139](https://github.com/max-team/Mars/issues/139)) ([bf9dd89](https://github.com/max-team/Mars/commit/bf9dd89)) | ||
## [1.0.22](https://github.com/max-team/Mars/compare/@marsjs/api@1.0.21...@marsjs/api@1.0.22) (2019-06-27) | ||
@@ -8,0 +19,0 @@ |
@@ -19,2 +19,6 @@ /** | ||
import {createAnimation, animationDirective} from './api/createAnimation'; | ||
import * as media from './api/media'; | ||
import * as battery from './api/battery'; | ||
import * as motion from './api/motion'; | ||
import * as clipboard from './api/clipboard'; | ||
@@ -42,4 +46,8 @@ export const directives = { | ||
createAnimation | ||
} | ||
}, | ||
media, | ||
battery, | ||
motion, | ||
clipboard | ||
); | ||
} |
@@ -98,2 +98,10 @@ /** | ||
function isAndroid() { | ||
return /Android/.test(navigator.userAgent); | ||
} | ||
function isIOS() { | ||
return /iPhone|iPad/.test(navigator.userAgent); | ||
} | ||
/* eslint-disable fecs-export-on-declare */ | ||
@@ -104,3 +112,5 @@ export { | ||
shouleBeObject, | ||
getParameterError | ||
getParameterError, | ||
isAndroid, | ||
isIOS | ||
}; |
{ | ||
"name": "@marsjs/api", | ||
"version": "1.0.22", | ||
"version": "1.0.23", | ||
"browser": "index.js", | ||
@@ -12,3 +12,3 @@ "scripts": { | ||
}, | ||
"gitHead": "eba1b1c7df6cb8e958ac3cf25a6ae2fb7bb7a108" | ||
"gitHead": "48c85bdb1fff9fc9351f32647ee716ea4c722d8d" | ||
} |
110664
36
3292