Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

原生转h5错误,转换3款同是这个错误 #1484

Closed
mienv567 opened this issue Dec 12, 2018 · 8 comments
Closed

原生转h5错误,转换3款同是这个错误 #1484

mienv567 opened this issue Dec 12, 2018 · 8 comments

Comments

@mienv567
Copy link

qq 20181212183916

index.js?e6ae:897 Uncaught (in promise) TypeError: Class constructor BaseComponent cannot be invoked without 'new' at new WrappedComponent (index.js?e6ae:897) at mountComponent (index.js?1e21:1520) at ComponentWrapper.init (index.js?1e21:1870) at createElement (index.js?1e21:1384) at mountChild (index.js?1e21:1450) at mountVNode$1 (index.js?1e21:1440) at createElement (index.js?1e21:1390) at patch (index.js?1e21:931) at updateComponent (index.js?1e21:1647) at Route.forceUpdate (index.js?1e21:1761)

@taro-bot
Copy link

taro-bot bot commented Dec 12, 2018

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@luckyadam
Copy link
Member

贴一下相关的代码,以及报错那里可以点进去看下错在那一行

@mienv567
Copy link
Author

错误地方:webpack:///./node_modules/@tarojs/router/dist/index.js?e6ae
错误行897: _this = _possibleConstructorReturn(this, _getPrototypeOf(WrappedComponent).call(this, props, context));
编译后的h5文件位置下的代码 .temp/app.js

import '@tarojs/components';
import Nerv from "nervjs";

import './app.scss';
import Taro from '@tarojs/taro-h5';
import { Router } from '@tarojs/router';
Taro.initPxTransform({
  "designWidth": 750,
  "deviceRatio": {
    "640": 1.17,
    "750": 1,
    "828": 0.905
  }
});
var chuke = require('./libs/chuke.js');

class App extends Taro.Component {
  componentWillMount() {
    this.$app.globalData = this.globalData;

    this.globalData.systemInfo = Taro.getSystemInfoSync();
    //let extConfig = Taro.getExtConfigSync();
    this.globalData.url = 'https://xcx.51chuke.com/wx9231ad8f329d59d7/';
    this.globalData.baiduMapAk = 'u0hiiYSGESEd79g6wLvUNE9wKiBjLh31';
    this.globalData.mapKey = 'WFJBZ-4SLWJ-EH7FL-F3RO2-XRNCQ-7HF4F';
    this.globalData.siteName = '外卖';
    chuke.login();
  }

  globalData = {
    siteName: '',
    loginStatus: false,
    initStatus: false,
    pageData: new Object(),
    userInfo: null,
    systemInfo: null,
    location: null,
    url: '',
    baiduMapAk: '',
    mapKey: ''
  };
  config = {
    pages: ['pages/index/index', 'pages/order/index', 'pages/order/create', 'pages/order/remark', 'pages/store/index', 'pages/store/detail', 'pages/bonus/index', 'pages/user/index', 'pages/user/card', 'pages/order/detail'],
    window: {
      backgroundTextStyle: 'light',
      navigationBarBackgroundColor: '#000',
      navigationBarTextStyle: 'white',
      backgroundColor: '#fff'
    }
  };

  render() {
    return <Router mode={"hash"} publicPath={"/"} routes={[{
      path: '/pages/index/index',
      componentLoader: () => import( /* webpackChunkName: "index_index" */'./pages/index/index'),
      isIndex: true
    }, {
      path: '/pages/order/index',
      componentLoader: () => import( /* webpackChunkName: "order_index" */'./pages/order/index'),
      isIndex: false
    }, {
      path: '/pages/order/create',
      componentLoader: () => import( /* webpackChunkName: "order_create" */'./pages/order/create'),
      isIndex: false
    }, {
      path: '/pages/order/remark',
      componentLoader: () => import( /* webpackChunkName: "order_remark" */'./pages/order/remark'),
      isIndex: false
    }, {
      path: '/pages/store/index',
      componentLoader: () => import( /* webpackChunkName: "store_index" */'./pages/store/index'),
      isIndex: false
    }, {
      path: '/pages/store/detail',
      componentLoader: () => import( /* webpackChunkName: "store_detail" */'./pages/store/detail'),
      isIndex: false
    }, {
      path: '/pages/bonus/index',
      componentLoader: () => import( /* webpackChunkName: "bonus_index" */'./pages/bonus/index'),
      isIndex: false
    }, {
      path: '/pages/user/index',
      componentLoader: () => import( /* webpackChunkName: "user_index" */'./pages/user/index'),
      isIndex: false
    }, {
      path: '/pages/user/card',
      componentLoader: () => import( /* webpackChunkName: "user_card" */'./pages/user/card'),
      isIndex: false
    }, {
      path: '/pages/order/detail',
      componentLoader: () => import( /* webpackChunkName: "order_detail" */'./pages/order/detail'),
      isIndex: false
    }]} />;
  }

  constructor(props, context) {
    super(props, context);

    Taro._set$app(this);
  }

}

export default App;
Nerv.render(<App />, document.getElementById('app'));

@yuche
Copy link
Contributor

yuche commented Dec 13, 2018

看一下的根目录的 .babelrc

@mienv567
Copy link
Author

看一下的根目录的 .babelrc

没有这个文件

@mienv567
Copy link
Author

@yuche @luckyadam 看来还是tao-h5转换问题,现在所有小程序转成h5可以打开页面啦。所有页面操作按钮均可,只有css有点问题。我试着自己解决。使用的是最新版。

qq 20181215165533

@luckyadam
Copy link
Member

@mienv567 好的,有问题可以再开 issue 讨论下

@taro-bot
Copy link

taro-bot bot commented Dec 17, 2018

Hello~

您的问题楼上已经提供了解决方案,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

@taro-bot taro-bot bot removed the to be closed label Dec 19, 2018
@taro-bot taro-bot bot closed this as completed Dec 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants