feat: change test view to basic jtag upload and download page
This commit is contained in:
45
src/stores/dialog.ts
Normal file
45
src/stores/dialog.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import { isUndefined } from 'lodash';
|
||||
|
||||
export const useDialogStore = defineStore('dialog', () => {
|
||||
type Title = "Error" | "Info" | "Warn";
|
||||
const isDialogOpen = ref(false);
|
||||
const dialogTitle = ref<Title>("Error");
|
||||
const dialogContent = ref("这是一个错误");
|
||||
|
||||
function openDialog(title: Title, content?: string) {
|
||||
if (!isUndefined(content) && content.length != 0)
|
||||
dialogContent.value = content;
|
||||
dialogTitle.value = title;
|
||||
isDialogOpen.value = true;
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
isDialogOpen.value = false;
|
||||
}
|
||||
|
||||
function info(content?: string) {
|
||||
openDialog("Info", content);
|
||||
}
|
||||
|
||||
function error(content?: string) {
|
||||
openDialog("Error", content);
|
||||
}
|
||||
|
||||
function warn(content?: string) {
|
||||
openDialog("Warn", content);
|
||||
}
|
||||
|
||||
return {
|
||||
isDialogOpen,
|
||||
dialogTitle,
|
||||
dialogContent,
|
||||
openDialog,
|
||||
closeDialog,
|
||||
info,
|
||||
error,
|
||||
warn
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user