input 有個屬性accept="image/*" 這樣就可以了,同時在網(wǎng)上看到了其他答案,試了下沒啥效果。寫記錄下來
如下:
-
使用input:file標簽, 去調(diào)用系統(tǒng)默認相機,攝像,錄音功能,其實是有個capture屬性,直接說明需要調(diào)用什么功能 <input?type="file"?accept="image/*"?capture="camera"> <input?type="file"?accept="video/*"?capture="camcorder"> <input?type="file"?accept="audio/*"?capture="microphone"> capture表示,可以捕獲到系統(tǒng)默認的設(shè)備,比如:camera--照相機;camcorder--攝像機;microphone--錄音。 accept表示,直接打開系統(tǒng)文件目錄。
-
input:file標簽還支持一個multiple屬性,表示可以支持多選,如: <input?type="file"?accept="image/*"?multiple> 加上這個multiple后,capture就沒啥用了,因為multiple是專門用來支持多選的。