- 在 API 模块中添加获取版本信息的接口方法 - 在设置页面组件中引入 API 并调用版本获取方法 - 使用 onMounted 钩子在组件挂载时获取版本数据 - 将获取到的版本信息绑定到模板中显示 - 完成设置页面的初始功能实现
This commit is contained in:
@@ -5,6 +5,9 @@ const axiosInstance = axios.create({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
getVersion:() =>
|
||||||
|
axiosInstance.get('/api/version'),
|
||||||
|
|
||||||
getTokenList: () =>
|
getTokenList: () =>
|
||||||
axiosInstance.get('/api/token'),
|
axiosInstance.get('/api/token'),
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import api from "@/api.ts";
|
||||||
|
|
||||||
|
const version = ref('')
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
api.getVersion().then((response) => {
|
||||||
|
version.value = response.data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
TODO
|
{{ version }}
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Reference in New Issue
Block a user