mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-12 04:03:42 +08:00
opt: 优化 ItemList 组件样式
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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 = () => {
|
||||
|
||||
Reference in New Issue
Block a user