Vue about setting scrollLeft value

clipboard.png

The

requirement is to select the sub-component date in the first-level page and automatically put the selected date to the leftmost end in the second-level page, the same sub-component used in both pages.
in the click event, you can scroll to the corresponding position by directly modifying the scrollLeft value by clicking the trigger. Now you need to set the value of scrollLeft to make it in the correct position when the page is loaded
this.$refs.dateScroll.scrollLeft = this.time*100;

Aug.19,2021

guess

this.time = ...
this.$nextTick(()=>{
   this.$refs.dateScroll.scrollLeft = this.time*100 + 'px' 
})

the first floor is good,
should use this.$nextTick (() = > {


Native js can solve

Menu