Skip to content

feat(qr-code): Add the necessary attributes to the responsive #3456

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

Merged
merged 2 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions examples/sites/demos/pc/app/qr-code/style-composition-api.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<template>
<tiny-qr-code v-bind="params"></tiny-qr-code>
<div class="qr-code-container">
<div>
<tiny-button @click="changeColor">改变颜色</tiny-button>
</div>
<br />
<tiny-qr-code v-bind="params"></tiny-qr-code>
</div>
</template>

<script setup>
import { TinyQrCode } from '@opentiny/vue'
import { TinyQrCode, TinyButton } from '@opentiny/vue'
import { ref } from 'vue'

const params = {
const params = ref({
value: '测试二维码数据',
color: '#1677ff',
size: 250,
style: { background: '#f5f5f5', padding: '24px' }
})

const changeColor = () => {
params.value.color = '#666'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line params.value.color = '#666' seems to be incorrect. It should be params.value.color instead of params.color. Please verify the correct property path.

}
</script>
18 changes: 15 additions & 3 deletions examples/sites/demos/pc/app/qr-code/style.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<template>
<tiny-qr-code v-bind="params"></tiny-qr-code>
<div class="qr-code-container">
<div>
<tiny-button @click="changeColor">改变颜色</tiny-button>
</div>
<br />
<tiny-qr-code v-bind="params"></tiny-qr-code>
</div>
</template>

<script>
import { TinyQrCode } from '@opentiny/vue'
import { TinyQrCode, TinyButton } from '@opentiny/vue'

export default {
components: {
TinyQrCode
TinyQrCode,
TinyButton
},
data() {
return {
Expand All @@ -18,6 +25,11 @@ export default {
style: { background: '#f5f5f5', padding: '24px' }
}
}
},
methods: {
changeColor() {
this.params.color = '#666'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The line this.params.color = '#666' seems to be incorrect. It should be this.params.color instead of this.params.color. Please verify the correct property path.

}
}
}
</script>
12 changes: 11 additions & 1 deletion packages/renderless/src/qr-code/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,17 @@ export const renderless = (props, { reactive, watch, onMounted }, { vm, emit },
})

watch(
() => [props.level, props.value],
() => [
props.level,
props.value,
props.color,
props.style,
props.size,
props.icon,
props.level,
props.iconSize,
props.bordered
],
() => {
api.draw()
api.change()
Expand Down
Loading