Record some of the daily work encountered, thought for a while the need to change, I hope to help you and yourself
1. Component style issues
A Git update shows the mobile date selection component, vue2-datepicker, from two years ago.
The day view of the component’s year, month and day is hidden from the global style file in the project
Now you want to display the day part of a module separately. From seeing the problem to solving it, I made the following mistakes in order.
A wrong
Presupposing that the component is displaying the date by attribute setting, but not realizing that this is an artificial global style hiding directly leads to error 2 and subsequent errors, wasting a lot of time
Error 2
Two years ago, I updated a component that is not popular, and I confused the name when I searched online, because they look so much alike, vue2-datepicker and vue-datepicker, so I wasted a lot of time searching for the usage document of the latter and conducting experiments.
Error of three
There are no documented instructions for setting the properties of year, month and day, just the simplest usage and callback functions.
At this time, I also found that it was hidden in the style, so I made mistake four.
Error four
I tried to use :: V-deep inside the module to infiltrate the date component without noticing that the date selection component is in the body layer, the same level as the component, causing my style to fail
Error five
A new style tag without scoped was added to the component page to flush out the date component’s global style in this component. It turns out there are other time pickers in this component that do this. I was one straw away from crashing
Finally, I replaced these time pickers directly and used vant’s time picker. There was not much difference in style and it was much more comfortable. I no longer care when this piece of code for this project was written, to the point where the last update was recorded two years ago with such sparse functionality as datepiker.
There are better solutions and opinions, and what is wrong with my practice, welcome to leave a message ~