关于使用tauri如何实现选择文件并打印绝对路径

有点破防,作者本来打算使用前段的方法是去获取,奈何处于安全考虑不能直接通过html的形式来获取文件绝对路径,因此只能使用tauri提供的能力进行,如下是实现的过程:

pnpm tauri add dialog

接着代码如下:

import { open } from '@tauri-apps/plugin-dialog';

// Open a dialog
const file = await open({
  multiple: false,
  directory: false,
});
console.log(file);

参考:对话框 | Tauri

你可能感兴趣的:(前端)