mirror of https://gitee.com/godoos/godoos.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.5 KiB
66 lines
1.5 KiB
import { defineStore } from "pinia"
|
|
import { BrowserWindow } from "@/system";
|
|
import { ref } from 'vue';
|
|
export const useChooseStore = defineStore('chooseStore', () => {
|
|
const win:any = ref()
|
|
const path:any = ref([])
|
|
const ifShow = ref(false)
|
|
//const savePath:any = ref('')
|
|
const select = (title = '选择文件', fileExt:any) => {
|
|
|
|
win.value = new BrowserWindow({
|
|
title,
|
|
content: "Computer",
|
|
config: {
|
|
ext: fileExt,
|
|
path: '/'
|
|
},
|
|
icon: "gallery",
|
|
width: 700,
|
|
height: 500,
|
|
x: 100,
|
|
y: 100,
|
|
center: true,
|
|
minimizable: false,
|
|
resizable: true,
|
|
});
|
|
win.value.show()
|
|
ifShow.value = true
|
|
}
|
|
const saveFile = (title: string, fileExt: any) => {
|
|
// console.log('保存文件');
|
|
win.value = new BrowserWindow({
|
|
title,
|
|
content: "Computer",
|
|
config: {
|
|
ext: fileExt,
|
|
path: '/'
|
|
},
|
|
icon: "gallery",
|
|
width: 700,
|
|
height: 500,
|
|
x: 100,
|
|
y: 100,
|
|
center: true,
|
|
minimizable: false,
|
|
resizable: true,
|
|
footer: true
|
|
});
|
|
win.value.show()
|
|
// ifShow.value = true
|
|
}
|
|
const close = () => {
|
|
ifShow.value = false
|
|
win.value.close()
|
|
}
|
|
|
|
return {
|
|
win,
|
|
path,
|
|
ifShow,
|
|
select,
|
|
close,
|
|
saveFile
|
|
}
|
|
|
|
})
|