Files
aurora-admin/site/examples/listpicker.json
T

37 lines
6.0 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"slug": "listpicker",
"mode": "single",
"examples": [
{
"id": "listpicker-ex-1",
"title": "基础用法",
"titleSrc": "",
"desc": "",
"html": "<div class=\"demo\">\n <h1>Kole UI · ListPicker 组件(纯 H5)</h1>\n <p class=\"sub\">对齐 ListPicker 规范:下拉列表、多选、分组、搜索、全选、标签</p>\n <div class=\"demo-block\">\n <p class=\"hint\">技术栈多选(分组 + 搜索 + 全选)</p>\n <div class=\"kole-listpicker\" data-listpicker></div>\n </div>\n</div>",
"preview": {
"show": [
[
0
]
],
"hide": [],
"mode": "single"
},
"previewSafe": true,
"previewUnsafeReasons": [],
"source": "curated",
"code": {
"html": "<h1>Kole UI · ListPicker 组件(纯 H5)</h1>\n<p>对齐 ListPicker 规范:下拉列表、多选、分组、搜索、全选、标签</p>\n<p>技术栈多选(分组 + 搜索 + 全选)</p>\n<div class=\"kole-listpicker\"></div>",
"jsx": "import { useState } from 'react';\nimport { KoleListPicker } from 'kole-ui/react';\n\nconst OPTIONS = [\n { label: '前端', children: [{ value: 'vue', label: 'Vue' }, { value: 'react', label: 'React' }, { value: 'ng', label: 'Angular', disabled: true }] },\n { label: '后端', children: [{ value: 'java', label: 'Java' }, { value: 'go', label: 'Go' }, { value: 'py', label: 'Python' }] }\n];\n\nexport default function TechPicker() {\n const [tech, setTech] = useState(['vue', 'react']);\n return (\n <KoleListPicker\n options={OPTIONS}\n value={tech}\n onChange={setTech}\n filterable\n placeholder=\"请选择技术栈\"\n />\n );\n}",
"vue3": "<template>\n <KoleListPicker v-model=\"tech\" :options=\"OPTIONS\" :filterable=\"true\" placeholder=\"请选择技术栈\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue';\nimport { KoleListPicker } from 'kole-ui/vue3';\n\nconst OPTIONS = [\n { label: '前端', children: [{ value: 'vue', label: 'Vue' }, { value: 'react', label: 'React' }, { value: 'ng', label: 'Angular', disabled: true }] },\n { label: '后端', children: [{ value: 'java', label: 'Java' }, { value: 'go', label: 'Go' }, { value: 'py', label: 'Python' }] }\n];\n\nconst tech = ref(['vue', 'react']);\n</script>",
"vue2": "<template>\n <KoleListPicker v-model=\"tech\" :options=\"OPTIONS\" :filterable=\"true\" placeholder=\"请选择技术栈\" />\n</template>\n\n<script>\nimport { KoleListPicker } from 'kole-ui/vue2';\n\nexport default {\n components: { KoleListPicker },\n data() {\n return {\n tech: ['vue', 'react'],\n OPTIONS: [\n { label: '前端', children: [{ value: 'vue', label: 'Vue' }, { value: 'react', label: 'React' }, { value: 'ng', label: 'Angular', disabled: true }] },\n { label: '后端', children: [{ value: 'java', label: 'Java' }, { value: 'go', label: 'Go' }, { value: 'py', label: 'Python' }] }\n ]\n };\n }\n};\n</script>",
"tsx": "import { useState } from 'react';\nimport { KoleListPicker } from 'kole-ui/react';\n\ninterface PickerOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\ninterface PickerGroup {\n label: string;\n children: ReadonlyArray<PickerOption>;\n}\n\nconst OPTIONS: ReadonlyArray<PickerGroup> = [\n { label: '前端', children: [{ value: 'vue', label: 'Vue' }, { value: 'react', label: 'React' }, { value: 'ng', label: 'Angular', disabled: true }] },\n { label: '后端', children: [{ value: 'java', label: 'Java' }, { value: 'go', label: 'Go' }, { value: 'py', label: 'Python' }] },\n];\n\nexport default function TechPicker(): JSX.Element {\n const [tech, setTech] = useState<ReadonlyArray<string>>(['vue', 'react']);\n return (\n <KoleListPicker\n options={OPTIONS}\n value={tech}\n onChange={setTech}\n filterable\n placeholder=\"请选择技术栈\"\n />\n );\n}",
"vue3ts": "<template>\n <KoleListPicker v-model=\"tech\" :options=\"OPTIONS\" :filterable=\"true\" placeholder=\"请选择技术栈\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { KoleListPicker } from 'kole-ui/vue3';\n\ninterface PickerOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\ninterface PickerGroup {\n label: string;\n children: ReadonlyArray<PickerOption>;\n}\n\nconst OPTIONS: ReadonlyArray<PickerGroup> = [\n { label: '前端', children: [{ value: 'vue', label: 'Vue' }, { value: 'react', label: 'React' }, { value: 'ng', label: 'Angular', disabled: true }] },\n { label: '后端', children: [{ value: 'java', label: 'Java' }, { value: 'go', label: 'Go' }, { value: 'py', label: 'Python' }] },\n];\n\nconst tech = ref<ReadonlyArray<string>>(['vue', 'react']);\n</script>",
"vue2ts": "<template>\n <div>\n <KoleListPicker v-model=\"tech\" :options=\"OPTIONS\" :filterable=\"true\" placeholder=\"请选择技术栈\" />\n </div>\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue';\nimport { KoleListPicker } from 'kole-ui/vue2';\n\ninterface PickerOption {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\ninterface PickerGroup {\n label: string;\n children: ReadonlyArray<PickerOption>;\n}\n\nexport default Vue.extend({\n components: { KoleListPicker },\n data(): { tech: ReadonlyArray<string>; OPTIONS: ReadonlyArray<PickerGroup> } {\n return {\n tech: ['vue', 'react'],\n OPTIONS: [\n { label: '前端', children: [{ value: 'vue', label: 'Vue' }, { value: 'react', label: 'React' }, { value: 'ng', label: 'Angular', disabled: true }] },\n { label: '后端', children: [{ value: 'java', label: 'Java' }, { value: 'go', label: 'Go' }, { value: 'py', label: 'Python' }] },\n ],\n };\n },\n});\n</script>"
},
"notes": "依据 frameworks/ListPicker.html 脚本 L29-32 的分组 OPTIONS、L37 初值 [\"vue\",\"react\"]、L45 空态占位「请选择技术栈」、L57-58 搜索框与「全选」行;prop 名取自 ListPicker.jsx L15-22(options/value/defaultValue/filterable/placeholder/onChange)与 ListPicker.vue3.vue L36-41(modelValue/options/filterable/placeholder)。"
}
],
"curated": true
}