|
@@ -17,23 +17,28 @@ import setNormal from './images/setNormal.png';
|
|
|
import studentIcon from './images/studentIcon.png';
|
|
|
import studentNormal from './images/studentNormal.png';
|
|
|
import SilderItem from './modals/silderItem';
|
|
|
+import { useRoute, useRouter } from 'vue-router';
|
|
|
export default defineComponent({
|
|
|
name: 'layoutSilder',
|
|
|
setup() {
|
|
|
+ const router = useRouter();
|
|
|
+ const route = useRoute();
|
|
|
const itemInfoList = reactive([
|
|
|
{
|
|
|
activeIcon: indexIcon,
|
|
|
name: '主页',
|
|
|
normalIcon: indexNormal,
|
|
|
isActive: true,
|
|
|
- id: 1
|
|
|
+ id: 1,
|
|
|
+ router: '/'
|
|
|
},
|
|
|
{
|
|
|
activeIcon: studentIcon,
|
|
|
name: '学生',
|
|
|
normalIcon: studentNormal,
|
|
|
isActive: false,
|
|
|
- id: 2
|
|
|
+ id: 2,
|
|
|
+ router: '/studentList'
|
|
|
},
|
|
|
{
|
|
|
activeIcon: classIcon,
|
|
@@ -72,7 +77,6 @@ export default defineComponent({
|
|
|
}
|
|
|
]);
|
|
|
const checkNavBar = (item: any) => {
|
|
|
- console.log('checkNavBar', item);
|
|
|
itemInfoList.forEach((now: any) => {
|
|
|
now.isActive = false;
|
|
|
});
|
|
@@ -81,6 +85,9 @@ export default defineComponent({
|
|
|
now.isActive = true;
|
|
|
}
|
|
|
});
|
|
|
+ if (item.router) {
|
|
|
+ router.push(item.router);
|
|
|
+ }
|
|
|
console.log('checkNavBar', item);
|
|
|
};
|
|
|
return () => (
|