|
@@ -39,7 +39,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { mapActions, mapState } from 'vuex';
|
|
|
|
|
|
+import { mapActions, mapState,mapMutations } from 'vuex';
|
|
export default {
|
|
export default {
|
|
name: 'native',
|
|
name: 'native',
|
|
props: {},
|
|
props: {},
|
|
@@ -52,8 +52,36 @@ export default {
|
|
...mapState(['menu']),
|
|
...mapState(['menu']),
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- handleSelect(key, keyPath) {
|
|
|
|
- console.log(key, keyPath);
|
|
|
|
|
|
+ ...mapMutations(['setSubMenu']),
|
|
|
|
+ handleSelect(path, arr) {
|
|
|
|
+ let res = this.menu.filter(fil => {
|
|
|
|
+ let is_this = this.checkChildrens(fil, path);
|
|
|
|
+ return is_this;
|
|
|
|
+ });
|
|
|
|
+ if (res.length > 0) {
|
|
|
|
+ let this_menu = res[0];
|
|
|
|
+ if (this_menu.children.length > 0) {
|
|
|
|
+ this_menu = this_menu.children;
|
|
|
|
+ }
|
|
|
|
+ this.setSubMenu(this_menu);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ checkChildrens(fil, path){
|
|
|
|
+ let is_this = false;
|
|
|
|
+ if (fil.children) {
|
|
|
|
+ for (const item of fil.children) {
|
|
|
|
+ if (item.path === path) {
|
|
|
|
+ is_this = true;
|
|
|
|
+ break;
|
|
|
|
+ } else {
|
|
|
|
+ let res = this.checkChildrens(item, path);
|
|
|
|
+ if(res) {
|
|
|
|
+ is_this = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }return is_this;
|
|
},
|
|
},
|
|
turnTo(url) {
|
|
turnTo(url) {
|
|
window.open(url);
|
|
window.open(url);
|