npm.io
1.1.0 • Published 8 years ago

jinkela-cascader

Licence
MIT
Version
1.1.0
Deps
0
Size
51 kB
Vulns
0
Weekly
0

Jinkela-Cascader

Install

yarn install jinkela-cascader

Usage

new Cascader([args])
  • args Object Set of configurable options to set. Can have the following fields:

    • defaultValue Any The default value.
    • placeholder String The placeholder text.
    • options Array<option> Cascading options.
  • option Object The cascading option item. Can have the following fields:

    • value Any The item value. Defaults to text.
    • text String The item text. Defaults to value.
    • options Array<option> sub-options.

Demo

<script src="https://unpkg.com/jinkela@1.2.19/umd.js"></script>
<script src="https://unpkg.com/jinkela-cascader@1.0.0/index.js"></script>
<script>
addEventListener('DOMContentLoaded', () => {

  new Cascader({
    options: [
      {
        text: 'item 1', options: [
          { text: 'item 1.1' },
          { text: 'item 1.2' }
        ] 
      },
      { text: 'item 2' }
    ] 
  }).to(document.body);

});
</script>