40 lines
5.0 KiB
JSON
40 lines
5.0 KiB
JSON
{
|
||
"slug": "radiocard",
|
||
"curated": true,
|
||
"mode": "single",
|
||
"examples": [
|
||
{
|
||
"id": "radiocard-ex-1",
|
||
"title": "基础用法",
|
||
"titleSrc": "",
|
||
"desc": "",
|
||
"html": "<div class=\"kole-radiocard-grid\" id=\"app\" role=\"radio\" tabindex=\"0\" style=\"grid-template-columns:repeat(3,1fr)\"></div>",
|
||
"preview": {
|
||
"show": [
|
||
[
|
||
0
|
||
]
|
||
],
|
||
"hide": [],
|
||
"mode": "single"
|
||
},
|
||
"previewSafe": true,
|
||
"previewUnsafeReasons": [],
|
||
"source": "curated",
|
||
"code": {
|
||
"html": "<div class=\"kole-radiocard-grid\" role=\"radio\" tabindex=\"0\" style=\"grid-template-columns:repeat(3,1fr)\"></div>",
|
||
"jsx": "import { useState } from 'react';\nimport { KoleRadioCard } from 'kole-ui/react';\n\nconst options = [\n { label: '基础版', value: 'basic', desc: '适合个人与小团队,包含核心功能。', icon: '🟢' },\n { label: '专业版', value: 'pro', desc: '进阶报表与权限管理,适合成长型企业。', icon: '🔵' },\n { label: '旗舰版', value: 'max', desc: '全功能 + 专属支持,适合大型组织。', icon: '🟣' }\n];\n\nexport default function Demo() {\n const [value, setValue] = useState('pro');\n return <KoleRadioCard options={options} value={value} cols={3} onChange={setValue} />;\n}",
|
||
"vue3": "<script setup>\nimport { ref } from 'vue';\nimport { KoleRadioCard } from 'kole-ui/vue3';\n\nconst options = [\n { label: '基础版', value: 'basic', desc: '适合个人与小团队,包含核心功能。', icon: '🟢' },\n { label: '专业版', value: 'pro', desc: '进阶报表与权限管理,适合成长型企业。', icon: '🔵' },\n { label: '旗舰版', value: 'max', desc: '全功能 + 专属支持,适合大型组织。', icon: '🟣' }\n];\nconst value = ref('pro');\n</script>\n\n<template>\n <KoleRadioCard :options=\"options\" v-model=\"value\" :cols=\"3\" />\n</template>",
|
||
"vue2": "<template>\n <KoleRadioCard :options=\"options\" v-model=\"value\" :cols=\"3\" />\n</template>\n\n<script>\nimport { KoleRadioCard } from 'kole-ui/vue2';\n\nexport default {\n components: { KoleRadioCard },\n data() {\n return {\n value: 'pro',\n options: [\n { label: '基础版', value: 'basic', desc: '适合个人与小团队,包含核心功能。', icon: '🟢' },\n { label: '专业版', value: 'pro', desc: '进阶报表与权限管理,适合成长型企业。', icon: '🔵' },\n { label: '旗舰版', value: 'max', desc: '全功能 + 专属支持,适合大型组织。', icon: '🟣' }\n ]\n };\n }\n};\n</script>",
|
||
"tsx": "import { useState } from 'react';\nimport { KoleRadioCard } from 'kole-ui/react';\n\nconst options = [\n { label: '基础版', value: 'basic', desc: '适合个人与小团队,包含核心功能。', icon: '🟢' },\n { label: '专业版', value: 'pro', desc: '进阶报表与权限管理,适合成长型企业。', icon: '🔵' },\n { label: '旗舰版', value: 'max', desc: '全功能 + 专属支持,适合大型组织。', icon: '🟣' }\n];\n\nexport default function Demo(): JSX.Element {\n const [value, setValue] = useState<string>('pro');\n return <KoleRadioCard options={options} value={value} cols={3} onChange={setValue} />;\n}",
|
||
"vue3ts": "<template>\n\n <KoleRadioCard :options=\"options\" v-model=\"value\" :cols=\"3\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { KoleRadioCard } from 'kole-ui/vue3';\n\nconst options = [\n { label: '基础版', value: 'basic', desc: '适合个人与小团队,包含核心功能。', icon: '🟢' },\n { label: '专业版', value: 'pro', desc: '进阶报表与权限管理,适合成长型企业。', icon: '🔵' },\n { label: '旗舰版', value: 'max', desc: '全功能 + 专属支持,适合大型组织。', icon: '🟣' }\n];\nconst value = ref<string>('pro');\n</script>",
|
||
"vue2ts": "<template>\n\n <KoleRadioCard :options=\"options\" v-model=\"value\" :cols=\"3\" />\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue';\nimport { KoleRadioCard } from 'kole-ui/vue2';\n\nexport default {\n components: { KoleRadioCard },\n data(): Record<string, unknown> {\n return {\n value: 'pro',\n options: [\n { label: '基础版', value: 'basic', desc: '适合个人与小团队,包含核心功能。', icon: '🟢' },\n { label: '专业版', value: 'pro', desc: '进阶报表与权限管理,适合成长型企业。', icon: '🔵' },\n { label: '旗舰版', value: 'max', desc: '全功能 + 专属支持,适合大型组织。', icon: '🟣' }\n ]\n };\n }\n};\n</script>"
|
||
},
|
||
"notes": [
|
||
"依据 frameworks/RadioCard.html 第 15-19 行 DATA 的三条套餐数据(label/value/desc/icon)与第 20 行 selected = \"pro\",第 12 行 style 的 grid-template-columns:repeat(3,1fr) 即 cols=3。",
|
||
"prop 名见 frameworks/RadioCard.jsx 第 4 行参数表(options / value / cols / onChange)、frameworks/RadioCard.vue3.vue 第 16-20 行 defineProps(modelValue);React 端读的是 value(不是 modelValue),故 jsx 传 value。"
|
||
]
|
||
}
|
||
]
|
||
}
|