Vue+Electron 获取文件目录

来自泡泡学习笔记
跳到导航 跳到搜索
const selectedFolder = ref('');

function handleFile(event){
    const fileInput = event.target;
    const file = fileInput.files[0];

    var filePath="";
    var filePath_sep=file.path.split("\\");

    for(let i=0;i<filePath_sep.length-1;i++){
        filePath+=filePath_sep[i]+"\\";
    }

    selectedFolder.value = filePath;

    emit('setD', selectedFolder);

}

function SelectBasedir(event){
    document.getElementById("BasedirSelector").click();
}