forked from opentiny/tiny-vue
docs(action-menu,dropdown): [action-menu,dropdown] The Dropdown and ActionMenu component documents are optimized, and the warning message is removed. (#1068)
* docs(dropdown): [dropdown] Optimization of document for dropdown components * docs(action-menu): [action-menu] Optimization of document for action-menu components * fix(action-menu,dropdown): [action-menu,dropdown] Remove warning prompts from Dropdown and ActionMenu components * docs(action-menu): [action-menu] Optimize ActionMenu component documentation * test(dropdown): [dropdown] Optimizing Dropdown Component Test Cases * test(dropdown): [dropdown] Optimizing Dropdown Component Test Cases
This commit is contained in:
parent
34c3295ebe
commit
cbef397d4a
|
@ -4,4 +4,4 @@ title: ActionMenu 菜单按钮
|
||||||
|
|
||||||
# ActionMenu 菜单按钮
|
# ActionMenu 菜单按钮
|
||||||
|
|
||||||
> 提供一组操作按钮的组件,当按钮数量太多,自动将超出部分的按钮放置在一个下拉弹框中
|
提供一组操作按钮的组件,当按钮数量太多,自动将超出部分的按钮放置在一个下拉弹框中。
|
||||||
|
|
|
@ -4,4 +4,4 @@ title: ActionMenu
|
||||||
|
|
||||||
# ActionMenu
|
# ActionMenu
|
||||||
|
|
||||||
> Provide a set of components for operating buttons. When there are too many buttons, the excess buttons will be automatically placed in a drop-down pop-up box
|
Provide a set of components for operating buttons. When there are too many buttons, the excess buttons will be automatically placed in a drop-down pop-up box.
|
||||||
|
|
|
@ -76,12 +76,21 @@ export default {
|
||||||
'demoId': 'max-show-num',
|
'demoId': 'max-show-num',
|
||||||
'name': { 'zh-CN': '个数限制', 'en-US': 'Number limit' },
|
'name': { 'zh-CN': '个数限制', 'en-US': 'Number limit' },
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '<p>通过 <code>max-show-num</code> 属性设置显示最多显示菜单按钮的个数,默认为 2。</p>',
|
'zh-CN': '<p>通过 <code>max-show-num</code> 属性设置最多显示菜单按钮的个数,默认为 2。</p>',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>By setting the <code>max-show-num</code> attribute, the maximum number of displayed menu buttons is set to 2 by default.</p>'
|
'<p>By setting the <code>max-show-num</code> attribute, the maximum number of displayed menu buttons is set to 2 by default.</p>'
|
||||||
},
|
},
|
||||||
'codeFiles': ['max-show-num.vue']
|
'codeFiles': ['max-show-num.vue']
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'demoId': 'slot-item',
|
||||||
|
'name': { 'zh-CN': '菜单项插槽', 'en-US': 'Menu Slot' },
|
||||||
|
'desc': {
|
||||||
|
'zh-CN': '<p>通过 <code>item</code> 插槽自定义下拉选项的 HTML 模板。</p>',
|
||||||
|
'en-US': '<p>Customize the HTML template for dropdown options through the <code>item</code> slot.</p>'
|
||||||
|
},
|
||||||
|
'codeFiles': ['slot-item.vue']
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'demoId': 'events',
|
'demoId': 'events',
|
||||||
'name': { 'zh-CN': '事件', 'en-US': 'Menu Item Click Event' },
|
'name': { 'zh-CN': '事件', 'en-US': 'Menu Item Click Event' },
|
||||||
|
@ -103,22 +112,13 @@ export default {
|
||||||
'</div>\n'
|
'</div>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['events.vue']
|
'codeFiles': ['events.vue']
|
||||||
},
|
|
||||||
{
|
|
||||||
'demoId': 'slot-item',
|
|
||||||
'name': { 'zh-CN': '菜单项插槽', 'en-US': 'Menu Slot' },
|
|
||||||
'desc': {
|
|
||||||
'zh-CN': '<p>通过 <code>item</code> 插槽自定义下拉选项的 HTML 模板。</p>',
|
|
||||||
'en-US': '<p>Customize the HTML template for dropdown options through the <code>item</code> slot.</p>'
|
|
||||||
},
|
|
||||||
'codeFiles': ['slot-item.vue']
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
apis: [
|
apis: [
|
||||||
{
|
{
|
||||||
'name': 'action-menu',
|
'name': 'action-menu',
|
||||||
'type': 'component',
|
'type': 'component',
|
||||||
'properties': [
|
'props': [
|
||||||
{
|
{
|
||||||
'name': 'max-show-num',
|
'name': 'max-show-num',
|
||||||
'type': 'number',
|
'type': 'number',
|
||||||
|
@ -133,7 +133,7 @@ export default {
|
||||||
{
|
{
|
||||||
'name': 'more-text',
|
'name': 'more-text',
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'defaultValue': '更多',
|
'defaultValue': "'更多'",
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '下拉按钮文本',
|
'zh-CN': '下拉按钮文本',
|
||||||
'en-US': 'Dropdown button text'
|
'en-US': 'Dropdown button text'
|
||||||
|
@ -200,7 +200,7 @@ export default {
|
||||||
'zh-CN': '菜单项图标',
|
'zh-CN': '菜单项图标',
|
||||||
'en-US': 'Icon of a menu item'
|
'en-US': 'Icon of a menu item'
|
||||||
},
|
},
|
||||||
'demId': 'icon'
|
'demoId': 'icon'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'popper-class',
|
'name': 'popper-class',
|
||||||
|
@ -245,7 +245,7 @@ export default {
|
||||||
{
|
{
|
||||||
'name': 'text-field',
|
'name': 'text-field',
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'defaultValue': 'label',
|
'defaultValue': "'label'",
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '菜单按钮文本的键值',
|
'zh-CN': '菜单按钮文本的键值',
|
||||||
'en-US': 'Key values for menu button text'
|
'en-US': 'Key values for menu button text'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<p>点击后不收起菜单弹框:</p>
|
<p>点击后不收起菜单弹框:</p>
|
||||||
<tiny-dropdown :hide-on-click="false">
|
<tiny-dropdown :hide-on-click="false">
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<tiny-dropdown-menu>
|
<tiny-dropdown-menu>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<p>点击后不收起菜单弹框:</p>
|
<p>点击后不收起菜单弹框:</p>
|
||||||
<tiny-dropdown :hide-on-click="false">
|
<tiny-dropdown :hide-on-click="false">
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<tiny-dropdown-menu>
|
<tiny-dropdown-menu>
|
||||||
|
|
|
@ -51,7 +51,7 @@ test('配置式:使用 menu-options 和 text-field', async ({ page }) => {
|
||||||
const dropDownMenu = page.locator('body > .tiny-dropdown-menu')
|
const dropDownMenu = page.locator('body > .tiny-dropdown-menu')
|
||||||
const dropDownMenuItem = dropDownMenu.locator('.tiny-dropdown-item')
|
const dropDownMenuItem = dropDownMenu.locator('.tiny-dropdown-item')
|
||||||
|
|
||||||
await page.waitForTimeout(1200)
|
await page.waitForTimeout(2000)
|
||||||
await dropDown.hover()
|
await dropDown.hover()
|
||||||
await expect(dropDownMenu.first()).toBeVisible()
|
await expect(dropDownMenu.first()).toBeVisible()
|
||||||
await expect(dropDownMenuItem.first()).toContainText('老友粉')
|
await expect(dropDownMenuItem.first()).toContainText('老友粉')
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<tiny-dropdown @visible-change="visibleChange">
|
<tiny-dropdown>
|
||||||
<span>默认插槽</span>
|
<span>默认插槽</span>
|
||||||
<template #suffix-icon>
|
<template #suffix-icon>
|
||||||
<tiny-icon-ascending></tiny-icon-ascending>
|
<tiny-icon-ascending></tiny-icon-ascending>
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
<tiny-dropdown trigger="click">
|
<tiny-dropdown trigger="click">
|
||||||
<template #dropdown>
|
<template #dropdown>
|
||||||
<tiny-dropdown-menu>
|
<tiny-dropdown-menu>
|
||||||
<tiny-dropdown-item :icon="iconPlus">黄金糕</tiny-dropdown-item>
|
<tiny-dropdown-item :icon="tinyIconPlus">黄金糕</tiny-dropdown-item>
|
||||||
<tiny-dropdown-item :icon="iconPlusCircle">狮子头</tiny-dropdown-item>
|
<tiny-dropdown-item :icon="tinyIconPlusCircle">狮子头</tiny-dropdown-item>
|
||||||
<tiny-dropdown-item :icon="iconPlusSquare">螺蛳粉</tiny-dropdown-item>
|
<tiny-dropdown-item :icon="tinyIconPlusSquare">螺蛳粉</tiny-dropdown-item>
|
||||||
<tiny-dropdown-item :icon="iconCheckedLinear">双皮奶</tiny-dropdown-item>
|
<tiny-dropdown-item :icon="tinyIconCheckedLinear">双皮奶</tiny-dropdown-item>
|
||||||
<tiny-dropdown-item :icon="iconCheckedSur">蚵仔煎</tiny-dropdown-item>
|
<tiny-dropdown-item :icon="tinyIconCheckedSur">蚵仔煎</tiny-dropdown-item>
|
||||||
</tiny-dropdown-menu>
|
</tiny-dropdown-menu>
|
||||||
</template>
|
</template>
|
||||||
</tiny-dropdown>
|
</tiny-dropdown>
|
||||||
|
@ -36,11 +36,11 @@ import {
|
||||||
DropdownItem as TinyDropdownItem
|
DropdownItem as TinyDropdownItem
|
||||||
} from '@opentiny/vue'
|
} from '@opentiny/vue'
|
||||||
|
|
||||||
const TinyIconPlus = iconPlus()
|
const tinyIconPlus = iconPlus()
|
||||||
const TinyIconPlusCircle = iconPlusCircle()
|
const tinyIconPlusCircle = iconPlusCircle()
|
||||||
const TinyIconPlusSquare = iconPlusSquare()
|
const tinyIconPlusSquare = iconPlusSquare()
|
||||||
const TinyIconCheckedLinear = iconCheckedLinear()
|
const tinyIconCheckedLinear = iconCheckedLinear()
|
||||||
const TinyIconCheckedSur = iconCheckedSur()
|
const tinyIconCheckedSur = iconCheckedSur()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -4,4 +4,4 @@ title: Dropdown 下拉菜单
|
||||||
|
|
||||||
# Dropdown 下拉菜单
|
# Dropdown 下拉菜单
|
||||||
|
|
||||||
> 可以配置菜单列表,点击或悬浮时下拉,支持多级菜单
|
可以配置菜单列表,点击或悬浮时下拉,支持多级菜单。
|
||||||
|
|
|
@ -4,4 +4,4 @@ title: Dropdown drop-down list
|
||||||
|
|
||||||
# Dropdown drop-down list
|
# Dropdown drop-down list
|
||||||
|
|
||||||
> Can configure menu list, drop down when clicked or hovered, supports multi-level menus
|
Can configure menu list, drop down when clicked or hovered, supports multi-level menus.
|
||||||
|
|
|
@ -6,8 +6,8 @@ export default {
|
||||||
'demoId': 'basic-usage',
|
'demoId': 'basic-usage',
|
||||||
'name': { 'zh-CN': '基本用法', 'en-US': 'Basic Usage' },
|
'name': { 'zh-CN': '基本用法', 'en-US': 'Basic Usage' },
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '<p>使用 tiny-dropdown-item 定义菜单节点</p>\n',
|
'zh-CN': '<p>使用 tiny-dropdown-item 定义菜单节点。</p>\n',
|
||||||
'en-US': '<p>Define menu nodes using tiny-dropdown-item</p>\n'
|
'en-US': '<p>Define menu nodes using tiny-dropdown-item.</p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['basic-usage.vue']
|
'codeFiles': ['basic-usage.vue']
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,8 @@ export default {
|
||||||
'name': { 'zh-CN': '禁用', 'en-US': 'Disabled' },
|
'name': { 'zh-CN': '禁用', 'en-US': 'Disabled' },
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '<p>通过 <code>disabled</code> 属性设置 菜单 或者 菜单项 为禁用状态。</p>\n',
|
'zh-CN': '<p>通过 <code>disabled</code> 属性设置 菜单 或者 菜单项 为禁用状态。</p>\n',
|
||||||
'en-US': 'The <p>Use the<code>disabled</code>attribute to set the menu or menu item to a disabled state. </p>\n'
|
'en-US':
|
||||||
|
'The <p>Use the <code>disabled</code> attribute to set the menu or menu item to a disabled state. </p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['disabled.vue']
|
'codeFiles': ['disabled.vue']
|
||||||
},
|
},
|
||||||
|
@ -49,7 +50,7 @@ export default {
|
||||||
'zh-CN':
|
'zh-CN':
|
||||||
'<p>通过 <code>split-button</code> 属性,设置下拉菜单显示为按钮类型。仅按钮类型时,支持 <code>type</code> 属性设置按钮状态。</p>\n',
|
'<p>通过 <code>split-button</code> 属性,设置下拉菜单显示为按钮类型。仅按钮类型时,支持 <code>type</code> 属性设置按钮状态。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>Set the drop-down menu to display as a button type through the<code>split button</code>attribute. When only button types are used, the<code>type</code>attribute setting button status is supported.</p>\n'
|
'<p>Set the drop-down menu to display as a button type through the <code>split-button</code> attribute. When only button types are used, the <code>type</code> attribute setting button status is supported.</p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['split-button.vue']
|
'codeFiles': ['split-button.vue']
|
||||||
},
|
},
|
||||||
|
@ -70,7 +71,7 @@ export default {
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '通过 <p><code>tip</code> 属性设置提示信息,<code>tip-position</code> 属性设置提示信息的位置。</p>\n',
|
'zh-CN': '通过 <p><code>tip</code> 属性设置提示信息,<code>tip-position</code> 属性设置提示信息的位置。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>Set the prompt information through the<p><code>tip</code>attribute, and set the position of the prompt information through the<code>tip position</code>attribute.</p>\n'
|
'<p>Set the prompt information through the <code>tip</code> attribute, and set the position of the prompt information through the <code>tip-position</code> attribute.</p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['tip.vue']
|
'codeFiles': ['tip.vue']
|
||||||
},
|
},
|
||||||
|
@ -81,7 +82,7 @@ export default {
|
||||||
'zh-CN':
|
'zh-CN':
|
||||||
'<p>通过 <code>visible-arrow</code> 属性设置下拉弹框是否显示箭头,默认不显示。<code>visible-arrow</code> 为 true 时显示箭头。</p>\n',
|
'<p>通过 <code>visible-arrow</code> 属性设置下拉弹框是否显示箭头,默认不显示。<code>visible-arrow</code> 为 true 时显示箭头。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>Use the <code>visible arrow</code> attribute to set whether the drop-down pop-up box displays an arrow, which is not displayed by default< Show arrows when code>visible arrow</code>is true.</p>\n'
|
'<p>Use the <code>visible-arrow</code> attribute to set whether the drop-down pop-up box displays an arrow, which is not displayed by default show arrows when <code>visible-arrow</code> is true.</p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['visible-arrow.vue']
|
'codeFiles': ['visible-arrow.vue']
|
||||||
},
|
},
|
||||||
|
@ -92,7 +93,7 @@ export default {
|
||||||
'zh-CN':
|
'zh-CN':
|
||||||
'<p>通过 <code>hide-on-click</code> 属性设置点击菜单项后是否收起菜单弹框。默认为 true,点击后收起。</p>\n',
|
'<p>通过 <code>hide-on-click</code> 属性设置点击菜单项后是否收起菜单弹框。默认为 true,点击后收起。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>Use the <code>hide on click</code> attribute to set whether to collapse the menu pop-up after clicking on the menu item. The default is true, and it will be collapsed after clicking. </p>\n'
|
'<p>Use the <code>hide-on-click</code> attribute to set whether to collapse the menu pop-up after clicking on the menu item. The default is true, and it will be collapsed after clicking. </p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['hide-on-click.vue']
|
'codeFiles': ['hide-on-click.vue']
|
||||||
},
|
},
|
||||||
|
@ -102,7 +103,7 @@ export default {
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '<p>通过 <code>title</code> 属性设置触发源的文本,默认为 <code>下拉菜单</code>。</p>\n',
|
'zh-CN': '<p>通过 <code>title</code> 属性设置触发源的文本,默认为 <code>下拉菜单</code>。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>Set the text of the trigger source through the<code>title</code>attribute, which defaults to the<code>drop-down menu</code>.</p>\n'
|
'<p>Set the text of the trigger source through the <code>title</code> attribute, which defaults to the <code>drop-down-menu</code>.</p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['title.vue']
|
'codeFiles': ['title.vue']
|
||||||
},
|
},
|
||||||
|
@ -113,7 +114,7 @@ export default {
|
||||||
'zh-CN':
|
'zh-CN':
|
||||||
'<p><code>menu-options</code>属性:只使用 tiny-dropdown 组件配置式时使用。</p>\n<p><code>options</code>属性:使用 tiny-dropdown-menu 组件配置式时使用。</p>\n<p><code>text-field</code>属性:指定菜单文案显示的字段,默认为 label。 </p>\n<p><code>title</code>属性:设置触发源的文本。</p>\n',
|
'<p><code>menu-options</code>属性:只使用 tiny-dropdown 组件配置式时使用。</p>\n<p><code>options</code>属性:使用 tiny-dropdown-menu 组件配置式时使用。</p>\n<p><code>text-field</code>属性:指定菜单文案显示的字段,默认为 label。 </p>\n<p><code>title</code>属性:设置触发源的文本。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p><code>menu options</code>Properties: Used only when using the tiny dropdown component configuration</p>\n<p><code>options</code>Properties: Used when using the tiny dropdown menu component configuration</p> \n<p><code>text field</code>Attribute: specifies the field displayed in the menu copy, which defaults to label</p> \n<p><code>title</code>Property: Set the text of the trigger source</p>\n'
|
'<p><code>menu-options</code> properties: used only when using the tiny dropdown component configuration</p>\n<p> <code>options</code> properties: Used when using the tiny dropdown menu component configuration</p> \n<p><code>text-field</code> attribute: specifies the field displayed in the menu copy, which defaults to label</p> \n<p><code>title</code> attribute: Set the text of the trigger source</p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['options.vue']
|
'codeFiles': ['options.vue']
|
||||||
},
|
},
|
||||||
|
@ -135,21 +136,10 @@ export default {
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '<p>通过 <code>inherit-width</code> 属性设置下拉弹框的最小宽度继承触发源的宽度。</p>\n',
|
'zh-CN': '<p>通过 <code>inherit-width</code> 属性设置下拉弹框的最小宽度继承触发源的宽度。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>Inherit the width of the trigger source by setting the minimum width of the drop-down pop-up box through the<code>inherit width</code>attribute.</p>\n'
|
'<p>Inherit the width of the trigger source by setting the minimum width of the drop-down pop-up box through the <code>inherit-width</code> attribute.</p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['inherit-width.vue']
|
'codeFiles': ['inherit-width.vue']
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'demoId': 'events',
|
|
||||||
'name': { 'zh-CN': '事件', 'en-US': 'Events' },
|
|
||||||
'desc': {
|
|
||||||
'zh-CN':
|
|
||||||
'<p><code>button-click</code>:按钮类型时,监听左侧按钮点击事件。</p><p><code>item-click</code>:监听点击菜单项事件。</p><p><code>visible-change</code>:监听下拉弹框显示隐藏发生变化。</p>\n',
|
|
||||||
'en-US':
|
|
||||||
'<p><code>button-click</code>: When the button type is selected, listen for the left button click event.</p>\n<p><code>item-click</code>: Listens for menu item click events</p>\n<p>code>visible-change</code>: Listens for changes in the display and hiding of dropdown pop ups.</p>\n'
|
|
||||||
},
|
|
||||||
'codeFiles': ['events.vue']
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
'demoId': 'slots',
|
'demoId': 'slots',
|
||||||
'name': { 'zh-CN': '插槽', 'en-US': 'Slots' },
|
'name': { 'zh-CN': '插槽', 'en-US': 'Slots' },
|
||||||
|
@ -157,16 +147,27 @@ export default {
|
||||||
'zh-CN':
|
'zh-CN':
|
||||||
'<p>通过 <code>default</code> 插槽自定义触发源文本区域。<code>suffix-icon</code> 插槽自定义触发源图标区域。</p>\n',
|
'<p>通过 <code>default</code> 插槽自定义触发源文本区域。<code>suffix-icon</code> 插槽自定义触发源图标区域。</p>\n',
|
||||||
'en-US':
|
'en-US':
|
||||||
'<p>Customize the trigger source text area through the<code>default</code>slot.</p>\n<p>Customize the trigger source icon area through the<code>suffix icon</code>slot.</p>\n'
|
'<p>Customize the trigger source text area through the <code>default</code> slot.</p>\n<p>Customize the trigger source icon area through the <code>suffix-icon</code> slot.</p>\n'
|
||||||
},
|
},
|
||||||
'codeFiles': ['slots.vue']
|
'codeFiles': ['slots.vue']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'demoId': 'events',
|
||||||
|
'name': { 'zh-CN': '事件', 'en-US': 'Events' },
|
||||||
|
'desc': {
|
||||||
|
'zh-CN':
|
||||||
|
'<p><code>button-click</code>:按钮类型时,监听左侧按钮点击事件。</p><p><code>item-click</code>:监听点击菜单项事件。</p><p><code>visible-change</code>:监听下拉弹框显示隐藏发生变化。</p>\n',
|
||||||
|
'en-US':
|
||||||
|
'<p><code>button-click</code>: When the button type is selected, listen for the left button click event.</p>\n<p><code>item-click</code>: Listens for menu item click events</p>\n<p><code>visible-change</code>: Listens for changes in the display and hiding of dropdown pop ups.</p>\n'
|
||||||
|
},
|
||||||
|
'codeFiles': ['events.vue']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
apis: [
|
apis: [
|
||||||
{
|
{
|
||||||
'name': 'dropdown',
|
'name': 'dropdown',
|
||||||
'type': 'component',
|
'type': 'component',
|
||||||
'properties': [
|
'props': [
|
||||||
{
|
{
|
||||||
'name': 'disabled',
|
'name': 'disabled',
|
||||||
'type': 'boolean',
|
'type': 'boolean',
|
||||||
|
@ -280,7 +281,8 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'type',
|
'name': 'type',
|
||||||
'type': '"primary" | "success" | "warning" | "danger" | "info" | "text"',
|
'type': 'IButtonType',
|
||||||
|
'typeAnchorName': 'IButtonType',
|
||||||
'defaultValue': '',
|
'defaultValue': '',
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '按钮类型。注意:只在 split-button 为 true 的情况下有效',
|
'zh-CN': '按钮类型。注意:只在 split-button 为 true 的情况下有效',
|
||||||
|
@ -291,7 +293,7 @@ export default {
|
||||||
{
|
{
|
||||||
'name': 'title',
|
'name': 'title',
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'defaultValue': '下拉菜单',
|
'defaultValue': "'下拉菜单'",
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '自定义触发源的文本',
|
'zh-CN': '自定义触发源的文本',
|
||||||
'en-US': 'Text for custom trigger source'
|
'en-US': 'Text for custom trigger source'
|
||||||
|
@ -300,8 +302,8 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'trigger',
|
'name': 'trigger',
|
||||||
'type': '"hover" | "click"',
|
'type': "'hover' | 'click'",
|
||||||
'defaultValue': 'hover',
|
'defaultValue': "'hover'",
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '触发下拉的方式',
|
'zh-CN': '触发下拉的方式',
|
||||||
'en-US': 'Trigger the dropdown method'
|
'en-US': 'Trigger the dropdown method'
|
||||||
|
@ -388,11 +390,11 @@ export default {
|
||||||
{
|
{
|
||||||
'name': 'dropdown-menu',
|
'name': 'dropdown-menu',
|
||||||
'type': 'component',
|
'type': 'component',
|
||||||
'properties': [
|
'props': [
|
||||||
{
|
{
|
||||||
'name': 'options',
|
'name': 'options',
|
||||||
'type': 'IItem []',
|
'type': 'IItemData []',
|
||||||
'typeAnchorName': 'IItem',
|
'typeAnchorName': 'IItemData',
|
||||||
'defaultValue': '[]',
|
'defaultValue': '[]',
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '通过配置式设置菜单项的属性',
|
'zh-CN': '通过配置式设置菜单项的属性',
|
||||||
|
@ -402,8 +404,9 @@ export default {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'placement',
|
'name': 'placement',
|
||||||
'type': ' "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end"',
|
'type': 'IPlacementType',
|
||||||
'defaultValue': 'bottom-end',
|
'typeAnchorName': 'IPlacementType',
|
||||||
|
'defaultValue': "'bottom-end'",
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '菜单弹出位置',
|
'zh-CN': '菜单弹出位置',
|
||||||
'en-US': 'Menu pop-up location '
|
'en-US': 'Menu pop-up location '
|
||||||
|
@ -423,7 +426,7 @@ export default {
|
||||||
{
|
{
|
||||||
'name': 'text-field',
|
'name': 'text-field',
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'defaultValue': 'label',
|
'defaultValue': "'label'",
|
||||||
'desc': {
|
'desc': {
|
||||||
'zh-CN': '菜单项文本的字段,结合 options 属性使用',
|
'zh-CN': '菜单项文本的字段,结合 options 属性使用',
|
||||||
'en-US': 'The field of menu item text, used in conjunction with the options attribute'
|
'en-US': 'The field of menu item text, used in conjunction with the options attribute'
|
||||||
|
@ -447,7 +450,7 @@ export default {
|
||||||
{
|
{
|
||||||
'name': 'dropdown-item',
|
'name': 'dropdown-item',
|
||||||
'type': 'component',
|
'type': 'component',
|
||||||
'properties': [
|
'props': [
|
||||||
{
|
{
|
||||||
'name': 'disabled',
|
'name': 'disabled',
|
||||||
'type': 'boolean',
|
'type': 'boolean',
|
||||||
|
@ -531,7 +534,7 @@ interface IMenuOption {
|
||||||
name: 'IItemClickParam',
|
name: 'IItemClickParam',
|
||||||
type: 'interface',
|
type: 'interface',
|
||||||
code: `
|
code: `
|
||||||
interface IMenuOption {
|
interface IItemClickParam {
|
||||||
itemData: IItemData
|
itemData: IItemData
|
||||||
// dropdownItem 组件的实例
|
// dropdownItem 组件的实例
|
||||||
vm: {
|
vm: {
|
||||||
|
@ -552,6 +555,20 @@ interface IItemData {
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
divided?: boolean
|
divided?: boolean
|
||||||
}
|
}
|
||||||
|
`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'IButtonType',
|
||||||
|
type: 'type',
|
||||||
|
code: `
|
||||||
|
type IButtonType = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text'
|
||||||
|
`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'IPlacementType',
|
||||||
|
type: 'type',
|
||||||
|
code: `
|
||||||
|
type IPlacementType = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end'
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -173,7 +173,7 @@ export const handleClick =
|
||||||
|
|
||||||
export const computedGetIcon =
|
export const computedGetIcon =
|
||||||
({ constants, designConfig }: Pick<IDropdownItemRenderlessParams, 'constants' | 'designConfig'>) =>
|
({ constants, designConfig }: Pick<IDropdownItemRenderlessParams, 'constants' | 'designConfig'>) =>
|
||||||
(name: string = 'leftWardArrow'): object => {
|
(name = 'leftWardArrow'): object | string => {
|
||||||
return designConfig?.icons[name] || constants?.ICON_MAP[name]
|
return designConfig?.icons[name] || constants?.ICON_MAP[name]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,7 @@ export const renderless = (
|
||||||
{ parent, emit, vm, dispatch, mode, constants, designConfig }: IDropdownItemRenderlessParamUtils
|
{ parent, emit, vm, dispatch, mode, constants, designConfig }: IDropdownItemRenderlessParamUtils
|
||||||
): IDropdownItemApi => {
|
): IDropdownItemApi => {
|
||||||
const api = {} as IDropdownItemApi
|
const api = {} as IDropdownItemApi
|
||||||
const dropdownMenuVm = inject('dropdownMenuVm') as IDropdownMenuVm
|
const dropdownMenuVm = inject('dropdownMenuVm', null) as IDropdownMenuVm
|
||||||
|
|
||||||
if (mode === 'mobile' && dropdownMenuVm) {
|
if (mode === 'mobile' && dropdownMenuVm) {
|
||||||
dropdownMenuVm.state.children = [...dropdownMenuVm.state.children, vm]
|
dropdownMenuVm.state.children = [...dropdownMenuVm.state.children, vm]
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
v-if="itemData.children && itemData.children.length"
|
v-if="itemData.children && itemData.children.length"
|
||||||
class="tiny-dropdown-item__expand tiny-dropdown-menu__item-expand"
|
class="tiny-dropdown-item__expand tiny-dropdown-menu__item-expand"
|
||||||
>
|
>
|
||||||
<component :is="state.getIcon" />
|
<component :is="state.getIcon"></component>
|
||||||
</span>
|
</span>
|
||||||
<div class="tiny-dropdown-item__content tiny-dropdown-menu__item-content">
|
<div class="tiny-dropdown-item__content tiny-dropdown-menu__item-content">
|
||||||
<component v-if="icon" :is="icon" class="tiny-svg-size" />
|
<component v-if="icon" :is="icon" class="tiny-svg-size"></component>
|
||||||
<span class="tiny-dropdown-item__label">
|
<span class="tiny-dropdown-item__label">
|
||||||
<slot :item-data="itemData">
|
<slot :item-data="itemData">
|
||||||
<span>{{ label }}</span>
|
<span>{{ label }}</span>
|
||||||
|
|
Loading…
Reference in New Issue