Skip to content

Commit

Permalink
fix(plugin): fix enhance 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ilharp committed Jan 28, 2024
1 parent 121a63b commit 9d8b9c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/plugin/clients/enhance/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Config, Context, Schema, useConfig } from '@koishijs/client'
import { RemovableRef } from '@vueuse/core'
import type { RemovableRef } from '@vueuse/core'
import * as colorString from 'color-string'

declare global {
Expand Down Expand Up @@ -114,7 +114,7 @@ const send = (message: string) => {
const syncStyleSheet = (config: RemovableRef<Config>) => {
if (!styleSheet) return

switch (config.value.desktop.enhance) {
switch (config.value.desktop?.enhance) {
case 'enhanceColor':
styleSheet.innerHTML = baseCSS + enhanceColorCSS
break
Expand All @@ -128,7 +128,7 @@ const syncStyleSheet = (config: RemovableRef<Config>) => {
}

const syncTheme = (config: RemovableRef<Config>) => {
switch (config.value.desktop.enhance) {
switch (config.value.desktop?.enhance) {
case 'enhanceColor':
send(
`T${
Expand Down Expand Up @@ -195,7 +195,7 @@ const disposeEnhance = () => {

declare module '@koishijs/client' {
interface Config {
desktop: {
desktop?: {
enhance: 'off' | 'enhance' | 'enhanceColor' | 'enhanceTrans'
}
}
Expand Down Expand Up @@ -234,7 +234,7 @@ export default (ctx: Context) => {
ctx.on('ready', () => {
const config = useConfig()

if (config?.value?.desktop?.enhance !== 'off') {
if (config.value.desktop?.enhance !== 'off') {
enhance(config)
ctx.on('dispose', disposeEnhance)
}
Expand Down

0 comments on commit 9d8b9c0

Please sign in to comment.