主题色设置

This commit is contained in:
zhang zhuo 2025-06-19 17:10:42 +08:00
parent 2bfeeddef4
commit 8afca35cf5
6 changed files with 54 additions and 2 deletions

View File

@ -9,4 +9,7 @@ onError((error) => {
console.error(`[PI error]: ${error}`);
})
</script>
<style></style>
<style lang="scss">
@use '@/style/style.scss';
</style>

View File

@ -1,4 +1,12 @@
{
"easycom": {
"autoscan": true,
"custom": {
// uni-ui
"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
}
},
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",

View File

@ -3,6 +3,7 @@
<image class="logo" src="/static/logo.png"/>
<view class="text-area">
<text class="title">{{ title }}</text>
<button type="warn" plain="">{{ title }}</button>
</view>
</view>
</template>
@ -11,11 +12,14 @@
import {ref} from 'vue'
import {useI18n} from 'vue-i18n'
import api from "@/api/index"
import globalStore from "@/store/global";
const {t, locale} = useI18n()
const title = ref(t('index.title'))
const global = globalStore()
getInfo()
// getInfo()
// console.log(global.size)
async function getInfo() {
const res = await api.auth.info()

15
src/store/global.ts Normal file
View File

@ -0,0 +1,15 @@
import {defineStore} from "pinia";
const globalStore = defineStore('global', {
state: () => ({
size: '12px'
}),
actions: {
set_size(val: string) {
this.size = val
}
},
persist: true
})
export default globalStore

21
src/style/fix.scss Normal file
View File

@ -0,0 +1,21 @@
/* 覆盖uni-app主题色 */
:root {
--primary-color: #409EFF;
--UI-BG: #fff;
--UI-BG-1: #f7f7f7;
--UI-BG-2: #fff;
--UI-BG-3: #f7f7f7;
--UI-BG-4: #4c4c4c;
--UI-BG-5: #fff;
--UI-FG: #000;
--UI-FG-0: rgba(0, 0, 0, 0.9);
--UI-FG-HALF: rgba(0, 0, 0, 0.9);
--UI-FG-1: rgba(0, 0, 0, 0.5);
--UI-FG-2: rgba(0, 0, 0, 0.3);
--UI-FG-3: rgba(0, 0, 0, 0.1);
}
//uni-button[type='warn'] {
// background-color: #F56C6C!important;
//}

1
src/style/style.scss Normal file
View File

@ -0,0 +1 @@
@use "fix.scss";