main.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import "@common/less/reset.css";
  2. import 'babel-polyfill';
  3. import React from 'react';
  4. import ReactDOM from 'react-dom';
  5. import {Provider} from 'react-redux';
  6. import store from './store';
  7. import {AppContainer} from 'react-hot-loader';
  8. import HomePage from './modules/HomePage';
  9. import $ from 'jquery';
  10. import "@utils/jqprint";
  11. const render = (Component) => {
  12. //ie8 console兼容
  13. window.console = window.console || (function () {
  14. var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
  15. = c.clear = c.exception = c.trace = c.assert = function () { };
  16. return c;
  17. })();
  18. //ie8 onInput替代函数
  19. $.fn.onIe8Input = function (fn,thisVal) {
  20. return this.each(function () {
  21. var $this = $(this);
  22. var htmlold = $this.html();
  23. $this.bind('blur keyup paste cut mouseup', function (e) {
  24. var htmlnew = $this.html();
  25. if (htmlold !== htmlnew) {
  26. fn.call(thisVal,e);
  27. }
  28. })
  29. })
  30. };
  31. ReactDOM.render(
  32. <AppContainer>
  33. <Provider store={store}>
  34. <Component/>
  35. </Provider>
  36. </AppContainer>,
  37. document.getElementById('root')
  38. );
  39. };
  40. render(HomePage);
  41. if (module.hot) {
  42. module.hot.accept();
  43. }