You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
< docs >
-- -
order : 4
title :
zh - CN : 主题
en - US : Menu Themes
-- -
# # zh - CN
内建了两套主题 ` light ` 和 ` dark ` , 默认 ` light ` 。
# # en - US
There are two built - in themes : ` light ` and ` dark ` . The default value is ` light ` .
< / docs >
< template >
< div >
< a -switch
: checked = "theme === 'dark'"
checked -children = " Dark "
un -checked -children = " Light "
@change ="changeTheme"
/ >
< br / >
< br / >
< a -menu
v -model :openKeys ="openKeys"
v -model :selectedKeys ="selectedKeys"
style = "width: 256px"
mode = "inline"
:theme ="theme"
>
< a -menu -item key = "1" >
< template # icon >
< MailOutlined / >
< / template >
Navigation One
< / a - m e n u - i t e m >
< a -menu -item key = "2" >
< template # icon >
< CalendarOutlined / >
< / template >
Navigation Two
< / a - m e n u - i t e m >
< a -sub -menu key = "sub1" >
< template # icon >
< AppstoreOutlined / >
< / template >
< template # title > Navigation Three < / template >
< a -menu -item key = "3" > Option 3 < / a - m e n u - i t e m >
< a -menu -item key = "4" > Option 4 < / a - m e n u - i t e m >
< a -sub -menu key = "sub1-2" title = "Submenu" >
< a -menu -item key = "5" > Option 5 < / a - m e n u - i t e m >
< a -menu -item key = "6" > Option 6 < / a - m e n u - i t e m >
< / a - s u b - m e n u >
< / a - s u b - m e n u >
< a -sub -menu key = "sub2" >
< template # icon >
< SettingOutlined / >
< / template >
< template # title > Navigation Four < / template >
< a -menu -item key = "7" > Option 7 < / a - m e n u - i t e m >
< a -menu -item key = "8" > Option 8 < / a - m e n u - i t e m >
< a -menu -item key = "9" > Option 9 < / a - m e n u - i t e m >
< a -menu -item key = "10" > Option 10 < / a - m e n u - i t e m >
< / a - s u b - m e n u >
< / a - m e n u >
< / div >
< / template >
< script lang = "ts" >
import { defineComponent , reactive , toRefs } from 'vue' ;
import {
MailOutlined ,
CalendarOutlined ,
AppstoreOutlined ,
SettingOutlined ,
} from '@ant-design/icons-vue' ;
import type { MenuTheme } from 'ant-design-vue' ;
export default defineComponent ( {
components : {
MailOutlined ,
CalendarOutlined ,
AppstoreOutlined ,
SettingOutlined ,
} ,
setup ( ) {
const state = reactive ( {
theme : 'dark' as MenuTheme ,
selectedKeys : [ '1' ] ,
openKeys : [ 'sub1' ] ,
} ) ;
const changeTheme = ( checked : boolean ) => {
state . theme = checked ? 'dark' : 'light' ;
} ;
return {
... toRefs ( state ) ,
changeTheme ,
} ;
} ,
} ) ;
< / script >