|
@@ -31,18 +31,29 @@ import { Component, Vue, Prop, Watch, Emit } from "vue-property-decorator";
|
|
|
import menu from "@/store/modules/menu";
|
|
|
@Component
|
|
|
export default class extends Vue {
|
|
|
- private currSid = 0;
|
|
|
- private currPid = 0;
|
|
|
+ @Prop(Number)
|
|
|
+ private currId!: number;
|
|
|
@Prop(Boolean) private showHeader!: boolean;
|
|
|
get items() {
|
|
|
return menu.pList;
|
|
|
}
|
|
|
+ get info() {
|
|
|
+ return menu.info(this.currId);
|
|
|
+ }
|
|
|
+ get currPid() {
|
|
|
+ if (!this.info) return 0;
|
|
|
+ return this.info.pId || this.info.id;
|
|
|
+ }
|
|
|
+ get currSid() {
|
|
|
+ if (!this.info) return 0;
|
|
|
+ return this.info.id;
|
|
|
+ }
|
|
|
+
|
|
|
getSub(pid: number) {
|
|
|
return menu.subList(pid);
|
|
|
}
|
|
|
@Emit("change")
|
|
|
setCurrIndex(id: number, pid = id) {
|
|
|
- [this.currSid, this.currPid] = [id, pid];
|
|
|
return { id, pid };
|
|
|
}
|
|
|
}
|