main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. const render = (Component) => {
  11. //ie8 console兼容
  12. window.console = window.console || (function () {
  13. var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
  14. = c.clear = c.exception = c.trace = c.assert = function () { };
  15. return c;
  16. })();
  17. //ie8 onInput替代函数
  18. $.fn.onIe8Input = function (fn,thisVal) {
  19. return this.each(function () {
  20. var $this = $(this);
  21. var htmlold = $this.html();
  22. $this.bind('blur keyup paste cut mouseup', function (e) {
  23. var htmlnew = $this.html();
  24. if (htmlold !== htmlnew) {
  25. fn.call(thisVal,e);
  26. }
  27. })
  28. })
  29. };
  30. ReactDOM.render(
  31. <AppContainer>
  32. <Provider store={store}>
  33. <Component/>
  34. </Provider>
  35. </AppContainer>,
  36. document.getElementById('root')
  37. );
  38. };
  39. render(HomePage);
  40. if (module.hot) {
  41. module.hot.accept();
  42. }