diff --git a/docs/dropdown/detail/options.md b/docs/dropdown/detail/options.md index a71307f0..1f058f56 100644 --- a/docs/dropdown/detail/options.md +++ b/docs/dropdown/detail/options.md @@ -215,6 +215,20 @@ templet: function(d){ string +- + + + + +[customName](#options.customName) 2.8.14+ + + + + +自定义 `data` 数据源中常用的字段名称。 + + +object - diff --git a/docs/dropdown/index.md b/docs/dropdown/index.md index 6e40b627..5021eb6f 100644 --- a/docs/dropdown/index.md +++ b/docs/dropdown/index.md @@ -71,6 +71,27 @@ layui.use(function(){ {{- d.include("/dropdown/detail/options.data.md") }} +
+ +您可以对上述 `data` 中常用的字段进行自定义名称 2.8.14+ : + +
+ +``` +var dropdown = layui.dropdown; +// 渲染 +dropdown.render({ + elem: '', // 绑定元素选择器 + data: [], // 数据源 + customName: { // 自定义 data 字段名 --- 2.8.14+ + id: 'id', + title: 'title', + children: 'child' + }, + // 其他属性 … +}); +``` +

重载

diff --git a/docs/tree/detail/options.md b/docs/tree/detail/options.md index 6388963f..9a81b9a4 100644 --- a/docs/tree/detail/options.md +++ b/docs/tree/detail/options.md @@ -135,6 +135,20 @@ + + +[customName](#options.customName) 2.8.14+ + + + + +自定义 `data` 数据源中常用的字段名称。 + + +object +- + + text diff --git a/docs/tree/index.md b/docs/tree/index.md index a6831057..3bcb2e16 100644 --- a/docs/tree/index.md +++ b/docs/tree/index.md @@ -41,6 +41,27 @@ toc: true {{- d.include("/tree/detail/options.data.md") }} +
+ +您可以对上述 `data` 中常用的字段进行自定义名称 2.8.14+ : + +
+ +``` +var tree = layui.tree; +// 渲染 +tree.render({ + elem: '', // 绑定元素选择器 + id: 'test', // 自定义 id 索引 + data: [], // 数据源 + customName: { // 自定义 data 字段名 --- 2.8.14+ + id: 'id', + title: 'title', + children: 'children' + }, + // 其他属性 … +}); +```

获取选中的节点数据