JSPM

blear.ui.mobile-picker

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q41871F
  • License MIT

手机端数据联动选择器

Package Exports

  • blear.ui.mobile-picker

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (blear.ui.mobile-picker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

blear.ui.mobile-picker

npm module build status coverage

联动实例

配合blear.classes.linkage来实现数据联动。

var mobilePicker = new MobilePicker({
    title: '所在地区',
    length: 2
});
var linkage = new Linkage({
    length: 2
});
var urls = [
    '/api/district/provinces',
    '/api/district/cities'
];

linkage.on('getData', function (index, parent, done) {
    api({
        url: urls[index],
        query: {
            parent: parent
        }
    }, function (err, list) {
        if (err) {
            list = [];
        }

        done(list);
    });
});

linkage.on('changeList', function (index, list) {
    mobilePicker.render(index, list);
});

linkage.on('changeValue', function (index, value) {
    mobilePicker.changeValue(index, value);
});

linkage.ready(function () {
    mobilePicker.on('change', function (index, value) {
        linkage.change(index, value);
    });

    mobilePicker.on('setValue', function (value) {
        linkage.setValue(value);
    });
});