系统时间的定位,应该根据显示器的分别率可以适配
continuous-integration/drone/push Build is passing Details

wangxiaoshuang 2026-02-02 11:04:44 +08:00
parent 9b9c83797a
commit 5a8e1e5af7
1 changed files with 19 additions and 1 deletions

View File

@ -9,13 +9,28 @@ export default {
return { return {
time: '', time: '',
timer: null, timer: null,
suggestionTextColor: '#909399' suggestionTextColor: '#909399',
resizeObserver: null
} }
}, },
created() { created() {
this.getTime() this.getTime()
}, },
async mounted() { async mounted() {
this.resizeObserver = new ResizeObserver(entries => {
entries.forEach(entry => {
//
// const { width, height } = entry.contentRect;
// console.log(`${width}px, ${height}px`);
// data
// this.elementWidth = width;
// this.elementHeight = height;
this.dragDoc()
});
});
const body = document.getElementsByTagName('body')[0]
//
this.resizeObserver.observe(body);
this.dragDoc() this.dragDoc()
this.setColor() this.setColor()
}, },
@ -102,6 +117,9 @@ export default {
clearInterval(this.timer) clearInterval(this.timer)
this.timer = null this.timer = null
} }
if (this.resizeObserver) {
this.resizeObserver.disconnect();
}
} }
} }
</script> </script>