0.0.3 • Published 4 years ago

@jzyong/openfile v0.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

打开选择文件管理器

描述:打开文件管理器,返回promise(ie下返回一个类priomise对象),传入参数为一个file对象,有可能为false

// 用例:
<!DOCTYPE html>
<html>
<head>
    <title>dome1</title>
    <script src="../index.js"></script>
</head>
<body>
<button onclick="open()">按钮</button>

<script>
    var open = function () {
        // 可传入指定文件类型
        openFile('image/png')
        .then(function (file) { // 返回一个promist对象(ie下返回一个类priomise对象)
            if (file) { // 如果用户没有选择文件,或者input没有触发change事件则传入false
                console.log(file)
            }
        })
    }
</script>
</body>
</html>
0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago