zzyxyz_old_vue/src/pages/NoteShower.vue
ZZY 62429a13b2 refactor(src): 重构卡片和笔记的路由及页面逻辑
- 移除`config.json`中的文件API配置
- 将卡片和笔记的路由及组件整合至`index.ts`和对应的页面组件中
- 删除不再使用的`CardShower`组件
- 更新`NoteShower`组件以使用新的路由配置
- 重构`Home.vue`,移除编辑功能并使用新的卡片显示逻辑

BREAKING CHANGE: 卡片和笔记的API端点及相关配置已从`config.json`中移除。
2024-08-25 11:10:22 +08:00

49 lines
1.2 KiB
Vue

<template>
<Navbar/>
<!-- <Alert/> -->
<IFrame :frameUrl="noteUrl" :frameDoc="noteDoc"/>
</template>
<script setup lang='ts'>
import { computed, onMounted, ref, watch } from "vue"
import IFrame from '@/components/utils/IFrame.vue'
import Navbar from "@/components/Navbar.vue";
import Alert from '@/components/utils/Alert.vue'
import FetchWrapper from "@/components/utils/FetchWapper";
import { file_api } from '@/router/config.json';
const props = defineProps(['note_name', 'token'])
let isShow = ref(true)
const noteUrl = ref()
const noteDoc = ref()
onMounted(() => {
FetchWrapper.fetch(`${file_api.root_url}/${file_api.notes.url}/${props.note_name}?type=${file_api.notes.type}`,
{
timeout: 3000,
headers: {
'Content-Type': 'text/html',
},
})
.then(response => {
if (!response.ok) {
// throw new Error(`HTTP error! status: ${response.status}`);
// noteUrl.value = '/.notes/' + props.note_name + '.html';
return null;
}
return response.text();
})
.then(htmlText => {
noteUrl.value = null;
noteDoc.value = htmlText;
})
});
let msg = ref('msg')
let btnTxt = ref('btnTxt')
</script>
<style scoped>
</style>