问题
I am using react-dateTime Picker. react-datetime picker's css is not working.can any one tell me why it look like. It looks like this.
and second one this following function is working but css is working.
var yesterday = Datetime.moment().subtract( 1, 'day' );
var valid = function( current ){
return current.isAfter( yesterday );
};
回答1:
You need to load the CSS file included with the react-dateTime picker. There's a small note in the docs regarding this but it's easy to miss.
You need to include this CSS file at some point. This could be copied into a master CSS file, or imported into the component where you use the react-dateTime picker.
import "path/to/node_modules/react-datetime/css/react-datetime.css";
回答2:
@Iggy add the following code in your webpack.config file. 'script-loader!react-datetime/dist/react-datetime.min.js',
entry: [
'script-loader!jquery/dist/jquery.min.js',
'script-loader!foundation-sites/dist/foundation.min.js',
'script-loader!react-datetime/dist/react-datetime.min.js',//add this line in your webpack.config file
'./app/app.jsx'],
externals:{
jquery:'jQuery'
},
来源:https://stackoverflow.com/questions/44199630/react-datetime-picker-css-not-working