From ea71e31ff5bf782366081f466ff6d69b29b25850 Mon Sep 17 00:00:00 2001 From: yoyo <15014217605@163.com> Date: Fri, 8 Dec 2023 16:22:53 +0800 Subject: [PATCH] docs(cascader): [cascader, cascader-panel] Improve documentation (#1065) --- .../basic-usage-composition-api.vue | 4 +- .../pc/app/cascader-panel/basic-usage.vue | 3 +- .../cascader-panel-props-composition-api.vue | 4 +- .../cascader-panel/cascader-panel-props.vue | 4 +- .../cascader-panel/change-composition-api.vue | 3 +- .../demos/pc/app/cascader-panel/change.vue | 2 +- .../cascader-panel/webdoc/cascader-panel.js | 10 +- ...uto-load-checkStrictly-composition-api.vue | 3 +- .../app/cascader/auto-load-checkStrictly.vue | 3 +- .../cascader/auto-load-composition-api.vue | 4 +- .../sites/demos/pc/app/cascader/auto-load.vue | 3 +- .../app/cascader/events-composition-api.vue | 2 +- .../expand-trigger-composition-api.vue | 197 ++++++++++++++++- .../show-all-levels-composition-api.vue | 199 +++++++++++++++++- .../demos/pc/app/cascader/webdoc/cascader.js | 38 ++-- 15 files changed, 446 insertions(+), 33 deletions(-) diff --git a/examples/sites/demos/pc/app/cascader-panel/basic-usage-composition-api.vue b/examples/sites/demos/pc/app/cascader-panel/basic-usage-composition-api.vue index 3ed404eeb..23d6dc934 100644 --- a/examples/sites/demos/pc/app/cascader-panel/basic-usage-composition-api.vue +++ b/examples/sites/demos/pc/app/cascader-panel/basic-usage-composition-api.vue @@ -1,11 +1,13 @@ diff --git a/examples/sites/demos/pc/app/cascader-panel/webdoc/cascader-panel.js b/examples/sites/demos/pc/app/cascader-panel/webdoc/cascader-panel.js index 0323aca5a..91cb29df1 100644 --- a/examples/sites/demos/pc/app/cascader-panel/webdoc/cascader-panel.js +++ b/examples/sites/demos/pc/app/cascader-panel/webdoc/cascader-panel.js @@ -33,10 +33,10 @@ export default { 'name': { 'zh-CN': 'Props 选项', 'en-US': 'Props Options' }, 'desc': { 'zh-CN': `

-

通过 children 指定子级选项,默认值为 children。
+
通过 children 指定子级选项,默认值为 'children'。
通过 emitPath 是否返回由该节点所在的各级菜单的值所组成的数组。
-
通过 label 指定显示选项 label 值,默认为 label。
-
通过 value 指定值选项 value 值,默认为 value。
+
通过 label 指定显示选项 label 值,默认为 'label'。
+
通过 value 指定值选项 value 值,默认为 'value'。

`, 'en-US': `

specifies the child options through children, which defaults to children.
@@ -167,13 +167,13 @@ export default { ] }, { - 'name': 'ICascaderPanelConfig', + 'name': 'ICascaderPanelConfig ', 'type': 'interface', 'props': [ { 'name': 'expandTrigger', 'type': `'click' | 'hover'`, - 'defaultValue': 'click', + 'defaultValue': `'click'`, 'desc': { 'zh-CN': '次级菜单的展开方式', 'en-US': 'The expansion mode of the secondary menu' diff --git a/examples/sites/demos/pc/app/cascader/auto-load-checkStrictly-composition-api.vue b/examples/sites/demos/pc/app/cascader/auto-load-checkStrictly-composition-api.vue index 727eef973..9b1c52ba6 100644 --- a/examples/sites/demos/pc/app/cascader/auto-load-checkStrictly-composition-api.vue +++ b/examples/sites/demos/pc/app/cascader/auto-load-checkStrictly-composition-api.vue @@ -1,5 +1,5 @@ diff --git a/examples/sites/demos/pc/app/cascader/show-all-levels-composition-api.vue b/examples/sites/demos/pc/app/cascader/show-all-levels-composition-api.vue index ce6d02609..6339f9351 100644 --- a/examples/sites/demos/pc/app/cascader/show-all-levels-composition-api.vue +++ b/examples/sites/demos/pc/app/cascader/show-all-levels-composition-api.vue @@ -4,7 +4,202 @@ diff --git a/examples/sites/demos/pc/app/cascader/webdoc/cascader.js b/examples/sites/demos/pc/app/cascader/webdoc/cascader.js index d85ece607..b453b85d9 100644 --- a/examples/sites/demos/pc/app/cascader/webdoc/cascader.js +++ b/examples/sites/demos/pc/app/cascader/webdoc/cascader.js @@ -112,16 +112,24 @@ export default { 'desc': { 'zh-CN': `

- 当选中某一级时,动态加载该级下的选项。通过 props 属性中的 lazy 开启动态加载,并通过 lazyload 来设置加载数据源的方法。
- lazyload 方法有两个参数,第一个参数 node 为当前点击的节点,第二个 resolve 为数据加载完成的回调(必须调用)。
- 为了更准确的显示节点的状态,默认地可以使用leaf字段对节点数据添加是否为叶子节点的标志位,否则会简单地以有无子节点来判断是否为叶子节点。 +

当选中某一级时,动态加载该级下的选项。 +
通过 props 属性中的 lazy 开启动态加载,并通过 lazyload 来设置加载数据源的方法。
+
lazyload 方法有两个参数,第一个参数 node 为当前点击的节点,第二个 resolve 为数据加载完成的回调(必须调用)。
+

+

为了更准确的显示节点的状态,默认地(默认指没有设置props.leaf)可以使用leaf字段。
+
表明此节点是否为叶子节点,否则会简单地以有无子节点来判断是否为叶子节点。
+

`, 'en-US': `

- When a level is selected, the options under the level are dynamically loaded. Enable dynamic loading with lazy in the props property, and set the method of loading the data source with lazyload.
- The lazyload method takes two parameters, the first parameter node is the currently clicked node, and the second parameter resolve is the callback when the data load is complete (which must be called).
- In order to display the status of the node more accurately, the leaf field can be used by default to add the flag bit of whether the node is a leaf node. Otherwise, it will simply judge whether the node is a leaf node by whether there are child nodes. +

When a level is selected, dynamically loads the options under that level. +
enables dynamic loading with lazy in the props property, and sets the method of loading the data source with lazyload.
+
Thelazyload method takes two arguments, node for the current clicked node, and resolve for the callback (which must be called) when the data is loaded.
+

+

In order to more accurately display the state of the node, the leaf field can be used by default (the default means that props.leaf is not set).
+
indicates whether this node is a leaf, otherwise it is simply determined by the presence or absence of child nodes.
+

` }, @@ -142,10 +150,16 @@ export default { 'demoId': 'props-children', 'name': { 'zh-CN': '指定选项', 'en-US': 'Specify Options' }, 'desc': { - 'zh-CN': - '

Props

\n

通过 children 指定选项的子选项,默认为 children 。\n通过 value 指定指定选项的 value 值,默认为 value 。\n通过 label 指定选项标签,默认为 label 。

\n
\n', - 'en-US': - '

Props

\n

uses children to specify the sub-option of the option. The default value is children. \n Use value to specify the value of a specified option. The default value is value. \nUse label to specify the option label. The default value is label.

\n
\n' + 'zh-CN': `

+

通过 props.children 指定选项的子选项,默认为 'children' 。
+
通过 props.value 指定指定选项的 value 值,默认为 'value' 。
+
通过 props.label 指定选项标签,默认为 'label' 。
+

`, + 'en-US': `

+

specifies the suboptions of the option via props.children, which defaults to 'children'.
+
Specifies the value of the given option via props.value, which defaults to 'value'.
+
Specifies the option label via props.label, which defaults to 'label'.
+

` }, 'codeFiles': ['props-children.vue'] }, @@ -477,13 +491,13 @@ export default { ] }, { - 'name': 'ICascaderPanelConfig', + 'name': 'ICascaderPanelConfig ', 'type': 'interface', 'props': [ { 'name': 'expandTrigger', 'type': `'click' | 'hover'`, - 'defaultValue': 'click', + 'defaultValue': `'click'`, 'desc': { 'zh-CN': '次级菜单的展开方式', 'en-US': 'The expansion mode of the secondary menu'