Browse Source

menu使用vuex输出

lrf402788946 5 years ago
parent
commit
6d8ed67ce0
1 changed files with 4 additions and 10 deletions
  1. 4 10
      src/layout/index/native.vue

+ 4 - 10
src/layout/index/native.vue

@@ -39,28 +39,22 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import { mapActions, mapState } from 'vuex';
 export default {
 export default {
   name: 'native',
   name: 'native',
   props: {},
   props: {},
   components: {},
   components: {},
   data: () => ({
   data: () => ({
     activeIndex2: '',
     activeIndex2: '',
-    menu:[],
   }),
   }),
-  created() {
-    this.getMenu();
+  created() {},
+  computed: {
+    ...mapState(['menu']),
   },
   },
-  computed: {},
   methods: {
   methods: {
     handleSelect(key, keyPath) {
     handleSelect(key, keyPath) {
       console.log(key, keyPath);
       console.log(key, keyPath);
     },
     },
-    getMenu(){
-      let menu = sessionStorage.getItem('menu');
-      if(menu) {
-        this.$set(this, `menu`, JSON.parse(menu));
-      }
-    },
     turnTo(url) {
     turnTo(url) {
       window.open(url);
       window.open(url);
     },
     },