Meteor 反应选择组件不工作
我正在尝试使用的异步版本。我有一个正常版本的工作绝对好,但当我添加尝试使用Meteor 反应选择组件不工作,meteor,reactjs,react-select,Meteor,Reactjs,React Select,我正在尝试使用的异步版本。我有一个正常版本的工作绝对好,但当我添加尝试使用 看起来问题可能是Select.Async行中的“.Async”扩展,这可能会让Meteor感到困惑吗?我找到了问题所在:从npm安装当前安装的是版本0.9.x,但文档和示例已经更新到版本1.0.0-betaX,其中有突破性的更改 因此,Select.Async确实是个问题,从react Select github存储库开始,语法只在1.0以后才存在。更新我的代码以使用1.0.0-beta9版本修复了该问题 var Sel
看起来问题可能是
Select.Async
行中的“.Async”扩展,这可能会让Meteor感到困惑吗?我找到了问题所在:从npm安装当前安装的是版本0.9.x,但文档和示例已经更新到版本1.0.0-betaX,其中有突破性的更改
因此,Select.Async
确实是个问题,从react Select github存储库开始,语法只在1.0以后才存在。更新我的代码以使用1.0.0-beta9版本修复了该问题
var Select = require('react-select');
var getOptions = function(input, callback) {
setTimeout(function() {
callback(null, {
options: [
{ value: 'one', label: 'One' },
{ value: 'two', label: 'Two' }
],
// CAREFUL! Only set this to true when there are no more options,
// or more specific queries will not be sent to the server.
complete: true
});
}, 500);
};
<Select.Async
name="form-field-name"
loadOptions={getOptions}
/>
import React from 'react';
import Select from 'react-select';
const OrderHeaderEdit = React.createClass({
getOptions(input, callback) {
setTimeout(function () {
callback(null, {
options: [
{ value: 'one', label: 'One' },
{ value: 'two', label: 'Two' }
],
// CAREFUL! Only set this to true when there are no more options,
// or more specific queries will not be sent to the server.
complete: true
});
}, 500);
},
render() {
console.log("OrderHeaderEdit props: ", this.props);
var getOptions = function (input, callback) {
setTimeout(function () {
callback(null, {
options: [
{ value: 'one', label: 'One' },
{ value: 'two', label: 'Two' }
],
// CAREFUL! Only set this to true when there are no more options,
// or more specific queries will not be sent to the server.
complete: true
});
}, 500);
};
return (
<div>
<Select.Async
name="form-field-name"
loadOptions={getOptions}
/>
</div>
);
}
});
export default OrderHeaderEdit;