omi/components/cascader
dntzhang 47f6174709 feat(omi-cli): init component template 2021-08-05 16:03:38 +08:00
..
src feat(omiu): support demo debugging 2021-08-05 15:29:44 +08:00
.gitignore feat(cascader): add omiu component cascader & build preview with vite 2021-07-31 03:53:58 +08:00
README.md feat(cascader): add size & disabled props 2021-07-31 16:43:58 +08:00
demo.html feat(omiu): support demo debugging 2021-08-05 15:29:44 +08:00
index.html feat(cascader): add size & disabled props 2021-07-31 16:43:58 +08:00
package.json feat(omi-cli): init component template 2021-08-05 16:03:38 +08:00
tsconfig.json feat(cascader): add omiu component cascader & build preview with vite 2021-07-31 03:53:58 +08:00
vite.config.ts feat(omiu): support demo debugging 2021-08-05 15:29:44 +08:00

README.md

Cascader

Cascader

Import

import '@omiu/cascader'

Or use script tag to ref it.

<script src="https://unpkg.com/@omiu/cascader"></script>

Usage

<o-cascader></o-cascader>

API

Props

interface CascaderOption {
  value: string
  label: string
  /**
   * 是否禁用
   */
  disabled: boolean
  children?: CascaderOption[]
}

export interface CascaderProps {
  /**
   * 当前值(从父到子应当是一个数组)
   */
  value: string[]
  /**
   * 选项列表
   */
  options: CascaderOption[]
  /**
   * 尺寸 Todo
   */
  size?: 'default' | 'medium' | 'small' | 'mini'
  /**
   * 是否禁用
   */
  disabled?: boolean
  /**
   * 选项被点击后的回调函数
   */
  onOptionClick?: (item: any, index: any, evt: any) => void
}

默认属性

{
  value: []
}

Dev

尝试使用 vite 构建

cd components/cascader
yarn
# 开发预览
yarn dev
# 构建(目录位于 dist
yarn build
# 构建 demo
yarn build:demo
# 构建 scss
yarn build:scss