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

VueUiKpi component does not refresh when responsive data changes #78

Closed
salarxiao321 opened this issue Oct 14, 2024 · 1 comment
Closed
Labels
bug : dataset Dataset is not being computed properly reactivity Questions related to reactivity

Comments

@salarxiao321
Copy link

  • "vue": "^3.3.7"
  • "vue-data-ui": "^2.3.17" or "vue-data-ui": "^2.3.24"

`

<script setup> import { ref } from "vue"; import { VueDataUi } from "vue-data-ui"; import "vue-data-ui/style.css"; const config = ref({ animationFrames: 60, animationValueStart: 0, backgroundColor: "#FFFFFF", fontFamily: "inherit", layoutClass: "p-4 m-4 rounded-md shadow", layoutCss: "", prefix: "", suffix: "", title: "Title", titleBold: true, titleColor: "#1A1A1A", titleClass: "", titleCss: "", titleFontSize: 16, useAnimation: true, valueBold: true, valueColor: "#6376DD", valueClass: "", valueCss: "", valueFontSize: 32, valueRounding: 0, }); const dataset = ref(18); // 生成 1 到 20 之间的随机数 const getRandomNumber = () => { return Math.floor(Math.random() * 20) + 1; }; // 定时更新 dataset 的值 const updateDataset = () => { dataset.value = getRandomNumber(); }; // 设置定时器 let intervalId; const startTimer = () => { intervalId = setInterval(updateDataset, 5000); // 每 5 秒更新一次 }; const stopTimer = () => { if (intervalId) { clearInterval(intervalId); } }; // 在组件挂载时启动定时器 onMounted(() => { startTimer(); }); // 在组件卸载时停止定时器 onUnmounted(() => { stopTimer(); }); </script>

{{ dataset }}

`
@graphieros graphieros added the bug : dataset Dataset is not being computed properly label Oct 14, 2024
@graphieros
Copy link
Owner

graphieros commented Oct 14, 2024

Hi @salarxiao321

You can upgrade to v2.3.25 which fixes this issue.
The displayed data will change (and animate if config says so) when props.dataset changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug : dataset Dataset is not being computed properly reactivity Questions related to reactivity
Projects
None yet
Development

No branches or pull requests

2 participants