react-dateTime picker Css not working

旧街凉风 提交于 2019-12-12 18:17:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!