UNPKG

1.18 kBJavaScriptView Raw
1import React from '@react';
2import { Provider } from 'react-redux';
3import { createStore } from 'redux';
4import { reducer } from './store/index';
5import './pages/index/index';
6
7const store = new createStore(reducer, {
8 value: 12,
9 inputVal: 100
10});
11
12class Global extends React.Component {
13 globalData = {}
14 static config = {
15 window: {
16 navigationBarBackgroundColor: '#00afc7',
17 backgroundTextStyle: 'light',
18 backgroundColor: '#00afc7',
19 navigationBarTitleText: 'nanachi',
20 navigationBarTextStyle: 'white'
21 }
22 };
23 onLaunch() {
24 //针对快应用的全局getApp补丁
25 if (this.$data && typeof global === 'object') {
26 var ref = Object.getPrototypeOf(global) || global;
27 var _this = this;
28 this.globalData = this.$def.globalData;
29 ref.getApp = function() {
30 return _this;
31 };
32 }
33 console.log('App launched');//eslint-disable-line
34 }
35 render() {
36 return <Provider store={store}>{this.props.children}</Provider>
37 }
38}
39// eslint-disable-next-line
40export default App(new Global());