2023-07-08 22:59:16 +08:00
|
|
|
<script setup>
|
|
|
|
import {reactive} from "vue";
|
2023-07-11 16:11:15 +08:00
|
|
|
import {useWebNotification} from '@vueuse/core'
|
2023-07-08 22:59:16 +08:00
|
|
|
import {GetAllEnv} from "frontend/wailsjs/go/env/Env";
|
|
|
|
import {hideDebugger, showDebugger} from "src/utils/debugger/eruda";
|
2023-07-10 23:14:40 +08:00
|
|
|
import {useGlobalConfig} from "src/store/globalConfig";
|
|
|
|
import {storeToRefs} from "pinia";
|
2023-07-08 22:59:16 +08:00
|
|
|
|
|
|
|
const controller = reactive({
|
|
|
|
input: ""
|
|
|
|
})
|
|
|
|
|
|
|
|
function sendNotify() {
|
2023-07-12 00:35:32 +08:00
|
|
|
const options = {
|
|
|
|
title: '通知测试',
|
|
|
|
dir: 'auto',
|
|
|
|
body: "通知测试",
|
|
|
|
lang: 'zh-CN',
|
|
|
|
renotify: true,
|
|
|
|
tag: 'notify',
|
|
|
|
};
|
|
|
|
|
|
|
|
const notification = useWebNotification(options);
|
|
|
|
setTimeout(() => {
|
|
|
|
notification.close()
|
|
|
|
}, 5 * 1000)
|
|
|
|
notification.show()
|
2023-07-08 22:59:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function getAllEnv(){
|
|
|
|
GetAllEnv().then(allEnv => {
|
|
|
|
console.log(allEnv)
|
|
|
|
})
|
|
|
|
}
|
2023-07-10 23:14:40 +08:00
|
|
|
|
|
|
|
const globalConfig = useGlobalConfig()
|
|
|
|
const globalConfigState = storeToRefs(globalConfig)
|
|
|
|
|
|
|
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
|
|
import en from 'element-plus/dist/locale/en.mjs'
|
2023-07-11 01:27:05 +08:00
|
|
|
import {useGlobalTabs} from "src/store/globalTabs";
|
|
|
|
import {useRouter} from "vue-router";
|
2023-07-14 15:02:31 +08:00
|
|
|
import {ElAutoResizer} from "element-plus";
|
2023-07-10 23:14:40 +08:00
|
|
|
function switchLocale(){
|
|
|
|
console.log(globalConfigState.ui.value.locale)
|
|
|
|
if(globalConfigState.ui.value.locale.name === 'zh-cn'){
|
|
|
|
globalConfig.$patch(state=>{
|
|
|
|
state.ui.locale = en
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
globalConfig.$patch(state=>{
|
|
|
|
state.ui.locale = zhCn
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2023-07-11 01:27:05 +08:00
|
|
|
|
|
|
|
const router = useRouter()
|
2023-07-11 16:11:15 +08:00
|
|
|
const globalTabState = useGlobalTabs()
|
2023-07-11 01:27:05 +08:00
|
|
|
function addTab(){
|
2023-07-11 16:11:15 +08:00
|
|
|
globalTabState.addTab({
|
2023-07-11 01:27:05 +08:00
|
|
|
name: "/test",
|
|
|
|
title: "测试",
|
|
|
|
})
|
2023-07-11 16:11:15 +08:00
|
|
|
globalTabState.tab = "/test"
|
2023-07-11 01:27:05 +08:00
|
|
|
}
|
2023-07-13 02:13:10 +08:00
|
|
|
|
|
|
|
const generateColumns = (length = 10, prefix = 'column-', props) =>
|
|
|
|
Array.from({ length }).map((_, columnIndex) => ({
|
|
|
|
...props,
|
|
|
|
key: `${prefix}${columnIndex}`,
|
|
|
|
dataKey: `${prefix}${columnIndex}`,
|
|
|
|
title: `Column ${columnIndex}`,
|
|
|
|
width: 150,
|
|
|
|
}))
|
|
|
|
|
2023-07-14 15:02:31 +08:00
|
|
|
const generateData = (
|
|
|
|
columns,
|
|
|
|
length = 200,
|
|
|
|
prefix = 'row-'
|
|
|
|
) =>
|
|
|
|
Array.from({ length }).map((_, rowIndex) => {
|
|
|
|
return columns.reduce(
|
|
|
|
(rowData, column, columnIndex) => {
|
|
|
|
rowData[column.dataKey] = `Row ${rowIndex} - Col ${columnIndex}`
|
|
|
|
return rowData
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: `${prefix}${rowIndex}`,
|
|
|
|
parentId: null,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
2023-07-13 02:13:10 +08:00
|
|
|
const table = reactive({
|
2023-07-14 15:02:31 +08:00
|
|
|
columns: generateColumns(10),
|
|
|
|
data: generateData(generateColumns(10),20)
|
2023-07-13 02:13:10 +08:00
|
|
|
})
|
|
|
|
|
2023-07-08 22:59:16 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="result w-full text-center" id="result">Please enter your name below 👇</div>
|
|
|
|
<div class="input-box w-full text-center" id="input">
|
|
|
|
<el-input v-model="controller.input" type="text" autocomplete="off"></el-input>
|
|
|
|
<el-button class="btn" @click="sendNotify()">通知</el-button>
|
|
|
|
</div>
|
|
|
|
<el-button @click="getAllEnv()">获取所有环境变量</el-button>
|
|
|
|
|
|
|
|
<div>
|
|
|
|
<el-button @click="showDebugger()">显示 debugger</el-button>
|
|
|
|
<el-button @click="hideDebugger()">隐藏 debugger</el-button>
|
|
|
|
</div>
|
2023-07-10 23:14:40 +08:00
|
|
|
|
|
|
|
<el-button @click="switchLocale()">切换 locale</el-button>
|
2023-07-14 15:02:31 +08:00
|
|
|
<div style="height: 50vh">
|
|
|
|
<el-auto-resizer>
|
|
|
|
<template #default="{ height, width}">
|
|
|
|
<el-table-v2 mb-1 :height="height" :width="width" :data="table.data" :columns="table.columns" fixed/>
|
|
|
|
</template>
|
|
|
|
</el-auto-resizer>
|
|
|
|
</div>
|
|
|
|
|
2023-07-10 23:14:40 +08:00
|
|
|
<el-pagination :total="100" />
|
2023-07-11 01:27:05 +08:00
|
|
|
|
|
|
|
<el-button @click="addTab()">添加tab</el-button>
|
2023-07-08 22:59:16 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|