39 lines
2.4 KiB
JSON
39 lines
2.4 KiB
JSON
{
|
||
"slug": "calendar",
|
||
"mode": "single",
|
||
"curated": true,
|
||
"examples": [
|
||
{
|
||
"id": "calendar-ex-1",
|
||
"title": "基础用法",
|
||
"titleSrc": "",
|
||
"desc": "",
|
||
"html": "<div class=\"kole-calendar\" id=\"app\" role=\"grid\"></div>",
|
||
"preview": {
|
||
"show": [
|
||
[
|
||
0
|
||
]
|
||
],
|
||
"hide": [],
|
||
"mode": "single"
|
||
},
|
||
"previewSafe": true,
|
||
"previewUnsafeReasons": [],
|
||
"source": "curated",
|
||
"code": {
|
||
"html": "<div class=\"kole-calendar\" role=\"grid\"></div>",
|
||
"jsx": "import { useState } from 'react';\nimport { KoleCalendar } from 'kole-ui/react';\n\nexport default function Demo() {\n // 选中日期,格式 yyyy-mm-dd\n const [date, setDate] = useState('2026-09-23');\n return <KoleCalendar value={date} onChange={setDate} />;\n}",
|
||
"vue3": "<template>\n <KoleCalendar v-model=\"date\" />\n</template>\n\n<script setup>\nimport { ref } from 'vue';\nimport { KoleCalendar } from 'kole-ui/vue3';\n\n// 选中日期,格式 yyyy-mm-dd\nconst date = ref('2026-09-23');\n</script>",
|
||
"vue2": "<template>\n <KoleCalendar v-model=\"date\" />\n</template>\n\n<script>\nimport { KoleCalendar } from 'kole-ui/vue2';\n\nexport default {\n components: { KoleCalendar },\n data() {\n return {\n // 选中日期,格式 yyyy-mm-dd\n date: '2026-09-23'\n };\n }\n};\n</script>",
|
||
"tsx": "import { useState } from 'react';\nimport { KoleCalendar } from 'kole-ui/react';\n\nexport default function Demo(): JSX.Element {\n // 选中日期,格式 yyyy-mm-dd\n const [date, setDate] = useState<string>('2026-09-23');\n return <KoleCalendar value={date} onChange={setDate} />;\n}",
|
||
"vue3ts": "<template>\n\n <KoleCalendar v-model=\"date\" />\n</template>\n\n<script setup lang=\"ts\">\nimport { KoleCalendar } from 'kole-ui/vue3';\n\n// 选中日期,格式 yyyy-mm-dd\nconst date = ref<string>('2026-09-23');\n</script>",
|
||
"vue2ts": "<template>\n\n <KoleCalendar v-model=\"date\" />\n</template>\n\n<script lang=\"ts\">\nimport Vue from 'vue';\nimport { KoleCalendar } from 'kole-ui/vue2';\n\nexport default {\n components: { KoleCalendar },\n data(): Record<string, unknown> {\n return {\n // 选中日期,格式 yyyy-mm-dd\n date: '2026-09-23'\n };\n }\n};\n</script>"
|
||
},
|
||
"notes": [
|
||
"依据 frameworks/Calendar.html:17-18(view 年月与 selected 初值)与 :42 的 is-today/is-selected 单元格态;prop value/onChange 取自 frameworks/Calendar.jsx:10"
|
||
]
|
||
}
|
||
]
|
||
}
|