Files
hamster-blog/blog-frontend/src/components/manage/SiteManageComponent.vue
2023-04-01 19:17:20 +08:00

28 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup lang="ts">
import { api, siteSetting } from '@/api';
function changeSetting(id: string, content: string) {
api.SettingController.updateSetting({ content }, id)
}
function changeCustomCSS(cssText: string) {
let cssElement = document.getElementById("custom-css")
siteSetting.css = cssText
if (cssElement != null) cssElement.innerText = cssText
api.SettingController.updateSetting({ "content": cssText }, siteSetting.keys.site.css)
}
</script>
<template>
<el-input v-model="siteSetting.title" placeholder="网站标题"
@change="changeSetting(siteSetting.keys.site.title, siteSetting.title)" show-word-limit maxlength="10" />
<el-input v-model="siteSetting.footer" placeholder="页脚文本支持HTML"
@change="changeSetting(siteSetting.keys.site.footer, siteSetting.footer)" show-word-limit maxlength="1024" />
<el-input v-model="siteSetting.css" placeholder="自定义CSS" @change="changeCustomCSS(siteSetting.css)" type="textarea"
autosize />
</template>
<style scoped>
.el-input {
margin-bottom: 5px;
}
</style>