The practical application of Vuex in the project

foreword

Recently let me engage in a caring version of the system. Pure front-end, speechless. That is, the fonts and frames of the entire system become larger. The simple and violent method is to rewrite a set of styles, which is impure and exhausting. After thinking about it, if a logo of the caring version can be saved, then all components can get the logo. Through this flag, then dynamically specify the style of the class. Vuex in Vue can reach the saved state, and all components can be accessed. Then it is also possible to dynamically set the style of the class.

1. Defined in Store

insert image description here
insert image description here

2. Storage status

One thing to note here

this.$store.commit('CareVersion/isCareVersion,'true

Guess you like

Origin blog.csdn.net/weixin_43304253/article/details/130531914