feat 侧边栏显示选中
This commit is contained in:
parent
910a020741
commit
786217f2af
@ -5,21 +5,28 @@
|
|||||||
style="width: 256px;"
|
style="width: 256px;"
|
||||||
mode="inline"
|
mode="inline"
|
||||||
:items="items"
|
:items="items"
|
||||||
|
:selectedKeys="selectedKeys"
|
||||||
></a-menu>
|
></a-menu>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import {AccountBookOutlined,FundOutlined, BellOutlined, DollarCircleOutlined, HddOutlined, DeploymentUnitOutlined, ToolOutlined} from "@ant-design/icons-vue";
|
import {AccountBookOutlined,FundOutlined, BellOutlined, DollarCircleOutlined, HddOutlined, DeploymentUnitOutlined, ToolOutlined} from "@ant-design/icons-vue";
|
||||||
import {h} from "vue";
|
import {computed, h, ref} from "vue";
|
||||||
import {useRouter} from "vue-router";
|
import {useRoute, useRouter} from "vue-router";
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
const onclick = ({key}) => {
|
const onclick = ({key}) => {
|
||||||
router.push({
|
router.push({
|
||||||
path: '/'+key
|
path: '/'+key
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const selectedKeys = computed(()=>{
|
||||||
|
return [route.path.split('/')[1]]
|
||||||
|
})
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
key: 'article',
|
key: 'article',
|
||||||
@ -65,8 +72,6 @@ const items = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
Loading…
Reference in New Issue
Block a user