opt: 优化 ItemList 组件样式

This commit is contained in:
RockYang
2023-11-11 10:53:33 +08:00
parent ce14cd02e4
commit 7b4ef8fc31
6 changed files with 26 additions and 27 deletions

View File

@@ -8,6 +8,7 @@
import {onMounted, ref, watch} from "vue";
// eslint-disable-next-line no-undef
const props = defineProps({
second: Number,
type: {
@@ -16,6 +17,7 @@ const props = defineProps({
}
});
// eslint-disable-next-line no-undef
const emits = defineEmits(['timeout']);
const counter = ref(props.second)
const timerStr = ref("")
@@ -34,7 +36,7 @@ const resetTimer = () => {
if (handler.value) {
clearInterval(handler.value)
}
counter.value = props.second
formatTimer(counter.value)
handler.value = setInterval(() => {
@@ -80,6 +82,7 @@ const formatTimer = (secs) => {
timerStr.value = timer.join("")
}
// eslint-disable-next-line no-undef
defineExpose({resetTimer})
</script>

View File

@@ -47,7 +47,7 @@ onMounted(() => {
const computeSize = () => {
const w = container.value.offsetWidth - 8 // 减去滚动条的宽度
let cols = Math.floor(w / props.width)
itemWidth.value = Math.floor(w / cols)
itemWidth.value = Math.ceil(w / cols) - 1
}
window.onresize = () => {