2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-07 16:47:14 +08:00

feat: 大部分视图支持消息总线

This commit is contained in:
耗子
2024-10-24 02:24:07 +08:00
parent f760dbaf80
commit fb88060824
13 changed files with 113 additions and 82 deletions

View File

@@ -22,6 +22,7 @@ const handleSubmit = async () => {
.create(model.value)
.then(() => {
window.$message.success('创建成功')
window.$bus.emit('ssh:refresh')
loading.value = false
show.value = false
model.value = {

View File

@@ -208,26 +208,17 @@ const onTermWheel = (event: WheelEvent) => {
}
}
watch(create, () => {
if (!create.value) fetchData()
})
watch(update, () => {
if (!update.value) {
fetchData()
updateId.value = 0
}
})
onMounted(() => {
// https://github.com/xtermjs/xterm.js/pull/5178
document.fonts.ready.then((fontFaceSet: any) =>
Promise.all(Array.from(fontFaceSet).map((el: any) => el.load())).then(fetchData)
)
window.$bus.on('ssh:refresh', fetchData)
})
onUnmounted(() => {
closeSession()
window.$bus.off('ssh:refresh')
})
</script>

View File

@@ -23,8 +23,10 @@ const handleSubmit = async () => {
.update(id.value, model.value)
.then(() => {
window.$message.success('更新成功')
id.value = 0
loading.value = false
show.value = false
window.$bus.emit('ssh:refresh')
})
.catch(() => {
loading.value = false