Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: cssPath is not reactive #49

Closed
1 task done
kymtwyf opened this issue Jul 6, 2024 · 1 comment · Fixed by #51
Closed
1 task done

[Bug Report]: cssPath is not reactive #49

kymtwyf opened this issue Jul 6, 2024 · 1 comment · Fixed by #51
Assignees
Labels
bug Something isn't working

Comments

@kymtwyf
Copy link
Contributor

kymtwyf commented Jul 6, 2024

Vue Code Block Version

2.3.2

Vue Version

3.4.31

Bug description

the cssPath property is not reactive, changing the value would not trigger reloading of the theme

Steps to reproduce

Example code:

<script setup lang="ts">
import { VCodeBlock } from '@wdns/vue-code-block';
import { ref, watchEffect } from 'vue';

const code = `const foo = 'bar';`
const theme = ref<string>("github")
const cssPath = ref<string | undefined>()

watchEffect(() => {
  if (theme.value === "github") {
    cssPath.value = "css/github.min.css"
  } else if (theme.value === "github-dark") {
    cssPath.value = "css/github-dark.min.css"
  } else {
    cssPath.value = undefined
  }
})
</script>

<template>
  <v-app>
    <v-main>
      <v-container>
        <p>Selected Theme: {{ theme }}</p>
        <p>CSS Path: {{ cssPath }}</p>

        <v-radio-group v-model="theme">
          <v-radio label="Github" value="github"></v-radio>
          <v-radio label="Github Dark" value="github-dark"></v-radio>
        </v-radio-group>
        <VCodeBlock highlightjs :code="code" :theme="theme" :cssPath="cssPath">

        </VCodeBlock>

      </v-container></v-main></v-app>
</template>

<style scoped></style>

Relevant log output

No response

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@kymtwyf kymtwyf added the bug Something isn't working label Jul 6, 2024
@webdevnerdstuff
Copy link
Owner

Good replication of issue. PR Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants