@cainiaofe/cn-ui-m
Version:
129 lines (128 loc) • 4.68 kB
JavaScript
import React from 'react';
import { CnCascaderSelect, CnDemoBlock, CnDemoPage } from "../../..";
var options = [
{
label: '浙江',
value: '浙江',
children: [
{
label: '杭州',
value: '杭州',
children: [
{
label: '西湖区',
value: '西湖区',
children: [],
},
{
label: '上城区',
value: '上城区',
},
{
label: '余杭区',
value: '余杭区',
disabled: true,
},
],
},
{
label: '温州',
value: '温州',
children: [
{
label: '鹿城区',
value: '鹿城区',
},
{
label: '龙湾区',
value: '龙湾区',
disabled: true,
},
{
label: '瓯海区',
value: '瓯海区',
},
],
},
{
label: '宁波',
value: '宁波',
children: [
{
label: '海曙区',
value: '海曙区',
},
{
label: '江北区',
value: '江北区',
},
{
label: '镇海区',
value: '镇海区',
},
],
},
],
},
{
label: '江苏',
value: '江苏',
children: [
{
label: '南京',
value: '南京',
children: [
{
label: '玄武区',
value: '玄武区',
},
{
label: '秦淮区',
value: '秦淮区',
},
{
label: '建邺区',
value: '建邺区',
},
],
},
{
label: '苏州',
value: '苏州',
children: [
{
label: '虎丘区',
value: '虎丘区',
},
{
label: '吴中区',
value: '吴中区',
},
{
label: '相城区',
value: '相城区',
},
],
},
],
},
];
export var 搜索 = function () {
return (React.createElement(CnDemoPage, { title: "\u641C\u7D22" },
React.createElement(CnDemoBlock, { title: "\u672C\u5730\u641C\u7D22", padding: 0 },
React.createElement(CnCascaderSelect, { dataSource: options, showSearch: true })),
React.createElement(CnDemoBlock, { title: "\u8FDC\u7A0B\u641C\u7D22\uFF0C\u4F7F\u7528\u81EA\u5B9A\u4E49\u641C\u7D22\u65B9\u6CD5", padding: 0 },
React.createElement(CnCascaderSelect, { dataSource: options, showSearch: true, filterLocal: false, onSearch: function (searchValue) {
console.log('searchValue', searchValue);
} })),
React.createElement(CnDemoBlock, { title: "\u8FDC\u7A0B\u641C\u7D22\uFF0C\u4F7F\u7528requestConfig", padding: 0 },
React.createElement(CnCascaderSelect, { dataSource: options, showSearch: true, filterLocal: false, requestConfig: {
url: 'https://oneapi.alibaba-inc.com/mock/kuw2pbp6/api/customaddress',
} })),
React.createElement(CnDemoBlock, { title: "\u8FDC\u7A0B\u641C\u7D22\uFF0C\u4F7F\u7528requestConfig\u548C\u81EA\u5B9A\u4E49\u641C\u7D22\u53C2\u6570", padding: 0 },
React.createElement(CnCascaderSelect, { dataSource: options, showSearch: true, filterLocal: false, requestConfig: {
url: 'https://oneapi.alibaba-inc.com/mock/kuw2pbp6/api/customaddress',
searchKey: 'customKey',
} }))));
};
export default { title: 'demo/CnCascaderSelect' };