Vue does topic switching.

items need to switch themes (not only colors, but also pictures). My current thinking is :

  1. scss the style of each component is written twice (two themes), and there are also two common component styles, which are extracted to the themes directory;
  2. main initializes the app_theme of localStorage to white (white theme);
  3. when loading, through the routing hook afterEach (to,from), using to and app_theme to distinguish, dynamic require which component of what color style, if it is a common component, load all common styles through app_theme.
  4. when switching, change the app_theme of the Storage and refresh the current page.

what are the drawbacks of this idea, or which god can provide a better idea?

Nov.29,2021
Menu