Skip to content

Commit

Permalink
Merge pull request #31 from k2tzumi/fix-default
Browse files Browse the repository at this point in the history
Fix default
  • Loading branch information
k2tzumi authored Mar 23, 2024
2 parents a5185da + 00d4f03 commit 6e9b0fc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ You can create a poll by using the [QRCode component](#QRCode).
```xml
<QRCode
value="https://github.com/k2tzumi/slidev-addon-qrcode"
width="180"
height="180"
:width="180"
:height="180"
color="4329B9"
image="83095831.png"
/>
Expand Down
22 changes: 14 additions & 8 deletions components/QRCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ import { watch, computed, onMounted, ref } from 'vue';
const qrCodeRef: any = ref(null);
const props = defineProps({
value: String,
color: String,
width: String,
height: String,
image: String,
export interface Props {
value: string,
color: string,
width: number,
height: number,
image: string,
}
const props = withDefaults(defineProps<Props>(), {
width: 200,
height: 200,
color: "000000",
});
const offsetColor = computed<string>(() => {
Expand Down Expand Up @@ -83,9 +89,9 @@ onMounted(async () => {
});
watch(
() => props.data,
() => props.value,
(newValue) => {
qrCode.update({ ...options, value: newValue });
qrCode.update({ ...options, data: newValue });
},
);
Expand Down
Binary file modified example-export/001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion example.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ layout: cover

# Example slides

<QRCode width="180" height="180" value="https://github.com/k2tzumi/slidev-addon-qrcode" color="4329B9" image="83095831.png" />
<QRCode :width=180 :height=180 value="https://github.com/k2tzumi/slidev-addon-qrcode" color="4329B9" image="83095831.png" />

0 comments on commit 6e9b0fc

Please sign in to comment.