From 77142dea58d9377ff2cd47746c6e592bc9557bfc Mon Sep 17 00:00:00 2001 From: songjian <1778651752@qq.com> Date: Thu, 5 Aug 2021 09:46:05 +0800 Subject: [PATCH] =?UTF-8?q?docs(dropdown):=20=E4=B8=8B=E6=8B=89=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=BB=84=E4=BB=B6=E5=A2=9E=E5=8A=A0=E9=92=88=E5=AF=B9?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E4=BD=BF=E7=94=A8=E7=9A=84=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dropdown/demos/enUS/icon.demo.md | 49 +++++++++++++++++++++ src/dropdown/demos/enUS/index.demo-entry.md | 1 + src/dropdown/demos/zhCN/icon.demo.md | 49 +++++++++++++++++++++ src/dropdown/demos/zhCN/index.demo-entry.md | 1 + 4 files changed, 100 insertions(+) create mode 100644 src/dropdown/demos/enUS/icon.demo.md create mode 100644 src/dropdown/demos/zhCN/icon.demo.md diff --git a/src/dropdown/demos/enUS/icon.demo.md b/src/dropdown/demos/enUS/icon.demo.md new file mode 100644 index 000000000..77edf3ddb --- /dev/null +++ b/src/dropdown/demos/enUS/icon.demo.md @@ -0,0 +1,49 @@ +# Icon + +```html + + User profile + +``` + +```js +import { h, defineComponent } from 'vue' +import { NIcon } from 'naive-ui' +import { + PersonCircleOutline as UserIcon, + Pencil as EditIcon, + LogOutOutline as LogoutIcon +} from '@vicons/ionicons5' + +const renderIcon = (icon) => { + return () => { + return h(NIcon, null, { + default: () => h(icon) + }) + } +} + +export default defineComponent({ + setup () { + return { + options: [ + { + label: 'Profile', + key: 'profile', + icon: renderIcon(UserIcon) + }, + { + label: 'Edit Profile', + key: 'editProfile', + icon: renderIcon(EditIcon) + }, + { + label: 'Logout', + key: 'logout', + icon: renderIcon(LogoutIcon) + } + ] + } + } +}) +``` diff --git a/src/dropdown/demos/enUS/index.demo-entry.md b/src/dropdown/demos/enUS/index.demo-entry.md index 62365303f..457f1d2be 100644 --- a/src/dropdown/demos/enUS/index.demo-entry.md +++ b/src/dropdown/demos/enUS/index.demo-entry.md @@ -6,6 +6,7 @@ When you have some functions to trigger. ```demo basic +icon trigger cascade arrow diff --git a/src/dropdown/demos/zhCN/icon.demo.md b/src/dropdown/demos/zhCN/icon.demo.md new file mode 100644 index 000000000..81b0e613a --- /dev/null +++ b/src/dropdown/demos/zhCN/icon.demo.md @@ -0,0 +1,49 @@ +# 图标 + +```html + + 用户资料 + +``` + +```js +import { h, defineComponent } from 'vue' +import { NIcon } from 'naive-ui' +import { + PersonCircleOutline as UserIcon, + Pencil as EditIcon, + LogOutOutline as LogoutIcon +} from '@vicons/ionicons5' + +const renderIcon = (icon) => { + return () => { + return h(NIcon, null, { + default: () => h(icon) + }) + } +} + +export default defineComponent({ + setup () { + return { + options: [ + { + label: '用户资料', + key: 'profile', + icon: renderIcon(UserIcon) + }, + { + label: '编辑用户资料', + key: 'editProfile', + icon: renderIcon(EditIcon) + }, + { + label: '退出登录', + key: 'logout', + icon: renderIcon(LogoutIcon) + } + ] + } + } +}) +``` diff --git a/src/dropdown/demos/zhCN/index.demo-entry.md b/src/dropdown/demos/zhCN/index.demo-entry.md index 939843d65..d60f9ed2a 100644 --- a/src/dropdown/demos/zhCN/index.demo-entry.md +++ b/src/dropdown/demos/zhCN/index.demo-entry.md @@ -6,6 +6,7 @@ ```demo basic +icon trigger cascade arrow