包括以下组件
无线电
名称 | 类型 | 默认 | 描述 |
---|---|---|---|
checked | 布尔值 | false | 定义无线电输入是否被选中 |
colors | 对象 | 带有 Tailwind CSS 颜色类的对象 | |
colors.bgCheckedIos | 字符串 | 'bg-primary' | |
colors.bgCheckedMaterial | 字符串 | 'bg-md-light-primary dark:bg-md-dark-primary' | |
colors.borderCheckedIos | 字符串 | 'border-primary' | |
colors.borderCheckedMaterial | 字符串 | 'border-md-light-primary dark:border-md-dark-primary' | |
colors.borderIos | 字符串 | 'border-black border-opacity-30 dark:border-white dark:border-opacity-30' | |
colors.borderMaterial | 字符串 | 'border-md-light-outline dark:border-md-dark-outline' | |
component | 字符串 | 'label' | 组件的 HTML 元素 |
defaultChecked | 布尔值 | false | 定义无线电输入是否被选中,用于它是不受控组件的情况 |
disabled | 布尔值 | false | 定义无线电输入是否被禁用 |
name | 字符串 | 无线电输入名称 | |
readonly | 布尔值 | false | 定义无线电输入是否为只读 |
touchRipple | 布尔值 | true | 在 Material 主题中启用触摸波纹效果 |
value | 任何 | 无线电输入值 |
名称 | 类型 | 描述 |
---|---|---|
change | function(e) | 当无线电状态改变时触发事件 |
无线电列表不是一个单独的组件,而只是使用 List
和 ListItem
组件的一种特殊情况。
<k-list>
<!-- Additional "label" prop on ListItem -->
<k-list-item label title="Books">
<template #media>
<!-- Pass Radio to list item media -->
<k-radio component="div" name="my-checkbox" />
</template>
</k-list-item>
<k-list-item label title="Movies">
<template #media>
<!-- Pass Radio to list item media -->
<k-radio component="div" name="my-checkbox" />
</template>
</k-list-item>
</k-list>
<template><k-page><k-navbar title="Radio" /><k-block-title>Inline</k-block-title><k-block strong-ios outline-ios><p>Lorem{{ ' ' }}<k-radioname="demo-radio-inline"value="inline-1":checked="inlineValue === 'inline-1'"@change="() => (inlineValue = 'inline-1')"/>{{ ' ' }} ipsum dolor sit amet, consectetur adipisicing elit. Aliasbeatae illo nihil aut eius commodi sint eveniet aliquid eligendi{{' '}}<k-radioname="demo-radio-inline"value="inline-2":checked="inlineValue === 'inline-2'"@change="() => (inlineValue = 'inline-2')"/>{{ ' ' }} ad delectus impedit tempore nemo, enim vel praesentiumconsequatur nulla mollitia!</p></k-block><k-block-title>Radio Group</k-block-title><k-list strong-ios outline-ios><k-list-item label title="Books"><template #media><k-radiocomponent="div"value="Books":checked="groupValue === 'Books'"@change="() => (groupValue = 'Books')"/></template></k-list-item><k-list-item label title="Movies"><template #media><k-radiocomponent="div"value="Movies":checked="groupValue === 'Movies'"@change="() => (groupValue = 'Movies')"/></template></k-list-item><k-list-item label title="Food"><template #media><k-radiocomponent="div"value="Food":checked="groupValue === 'Food'"@change="() => (groupValue = 'Food')"/></template></k-list-item><k-list-item label title="Drinks"><template #media><k-radiocomponent="div"value="Drinks":checked="groupValue === 'Drinks'"@change="() => (groupValue = 'Drinks')"/></template></k-list-item></k-list><k-list strong-ios outline-ios><k-list-item label title="Books"><template #after><k-radiocomponent="div"value="Books":checked="groupValue === 'Books'"@change="() => (groupValue = 'Books')"/></template></k-list-item><k-list-item label title="Movies"><template #after><k-radiocomponent="div"value="Movies":checked="groupValue === 'Movies'"@change="() => (groupValue = 'Movies')"/></template></k-list-item><k-list-item label title="Food"><template #after><k-radiocomponent="div"value="Food":checked="groupValue === 'Food'"@change="() => (groupValue = 'Food')"/></template></k-list-item><k-list-item label title="Drinks"><template #after><k-radiocomponent="div"value="Drinks":checked="groupValue === 'Drinks'"@change="() => (groupValue = 'Drinks')"/></template></k-list-item></k-list><k-block-title>With Media Lists</k-block-title><k-list strong-ios outline-ios><k-list-itemlabeltitle="Facebook"after="17:14"subtitle="New messages from John Doe"text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."><template #media><k-radiocomponent="div":checked="mediaValue === 'Item 1'"@change="() => (mediaValue = 'Item 1')"/></template></k-list-item><k-list-itemlabeltitle="John Doe (via Twitter)"after="17:11"subtitle="John Doe (@_johndoe) mentioned you on Twitter!"text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla sagittis tellus ut turpis condimentum, ut dignissim lacus tincidunt. Cras dolor metus, ultrices condimentum sodales sit amet, pharetra sodales eros. Phasellus vel felis tellus. Mauris rutrum ligula nec dapibus feugiat. In vel dui laoreet, commodo augue id, pulvinar lacus."><template #media><k-radiocomponent="div":checked="mediaValue === 'Item 2'"@change="() => (mediaValue = 'Item 2')"/></template></k-list-item></k-list></k-page></template><script>import { ref } from 'vue';import {kPage,kNavbar,kNavbarBackLink,kRadio,kBlockTitle,kBlock,kList,kListItem,} from 'konsta/vue';export default {components: {kPage,kNavbar,kNavbarBackLink,kRadio,kBlockTitle,kBlock,kList,kListItem,},setup() {const inlineValue = ref('inline-1');const groupValue = ref('Books');const mediaValue = ref('Item 1');return {inlineValue,groupValue,mediaValue,};},};</script>