项目作者: nicolaschan

项目描述 :
📇 Mithril select component with auto-complete as you type
高级语言: TypeScript
项目地址: git://github.com/nicolaschan/mithril-selector.git
创建时间: 2018-09-08T09:51:22Z
项目社区:https://github.com/nicolaschan/mithril-selector

开源协议:MIT License

下载


mithril-selector

Select component for Mithril.js with auto-completion. Inspired by selectize.js, which has more features but requires JQuery.

  • Suggest options as you type
  • Override CSS as you like
  • TypeScript support



Usage

  1. const { Select } = require('mithril-selector')
  2. const Content = {
  3. view: function (vnode) {
  4. return [
  5. m('div', `Current value: ${vnode.state.value}`),
  6. m('br'),
  7. m(Select, {
  8. value: vnode.state.value,
  9. placeholder: 'Select',
  10. options: [
  11. 'Option One', 'Option Two', 'Option Three'
  12. ],
  13. onselect: (value) => vnode.state.value = value
  14. })
  15. ]
  16. }
  17. }
  1. <!-- CSS files are located in node_modules/mithril-selector/style/dist -->
  2. <link rel="stylesheet" href="default.css">

See the example usage for a full working example.

Developing

  1. git clone https://github.com/nicolaschan/mithril-selector.git
  2. cd mithril-selector
  3. yarn install --production=false
  4. yarn build-example --watch
  5. # Then open example/index.html in your browser