feature:add i18n
This commit is contained in:
		@@ -5,6 +5,7 @@ const app = {
 | 
			
		||||
    sidebar: {
 | 
			
		||||
      opened: !+Cookies.get('sidebarStatus')
 | 
			
		||||
    },
 | 
			
		||||
    language: Cookies.get('language') || 'zh',
 | 
			
		||||
    visitedViews: [],
 | 
			
		||||
    cachedViews: []
 | 
			
		||||
  },
 | 
			
		||||
@@ -17,6 +18,10 @@ const app = {
 | 
			
		||||
      }
 | 
			
		||||
      state.sidebar.opened = !state.sidebar.opened
 | 
			
		||||
    },
 | 
			
		||||
    SET_LANGUAGE: (state, language) => {
 | 
			
		||||
      state.language = language
 | 
			
		||||
      Cookies.set('language', language)
 | 
			
		||||
    },
 | 
			
		||||
    ADD_VISITED_VIEWS: (state, view) => {
 | 
			
		||||
      if (state.visitedViews.some(v => v.path === view.path)) return
 | 
			
		||||
      state.visitedViews.push({
 | 
			
		||||
@@ -48,6 +53,9 @@ const app = {
 | 
			
		||||
    ToggleSideBar({ commit }) {
 | 
			
		||||
      commit('TOGGLE_SIDEBAR')
 | 
			
		||||
    },
 | 
			
		||||
    setLanguage({ commit }, language) {
 | 
			
		||||
      commit('SET_LANGUAGE', language)
 | 
			
		||||
    },
 | 
			
		||||
    addVisitedViews({ commit }, view) {
 | 
			
		||||
      commit('ADD_VISITED_VIEWS', view)
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user