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

react 下使用问题 #4

Open
superwunc opened this issue Sep 29, 2019 · 3 comments
Open

react 下使用问题 #4

superwunc opened this issue Sep 29, 2019 · 3 comments

Comments

@superwunc
Copy link

Hi,
我参考react 下的demo ,代码如下

import React from "react";
import HQChart from "hqchart";

class KLine extends React.Component {
  constructor(props) {
    //构造函数
    super(props);
    this.initCanvas = this.initCanvas.bind(this);
    this.state = {
      Symbol: "600000.sh",
      KLine: {
        JSChart: null,
        Option: {
          Symbol: "",
          Type: "历史K线图",

          //窗口指标
......

编译的时候,出现下面的错误

ERROR in ../node_modules/hqchart/src/jscommon/umychart.vue/umychart.stock.vue.js
Module not found: Error: Can't resolve 'jquery' in 'C:\clarkwu\stock_app\node_modules\hqchart\src\jscommon\umychart.vue'
 @ ../node_modules/hqchart/src/jscommon/umychart.vue/umychart.stock.vue.js 1274:8-9 1298:12-13 1809:8-9 1853:8-9 1898:8-9 1943:9-10 1988:8-9 2032:8-9 2058:8-9 2144:8-9 2206:8-9 2231:8-9 2259:8-9 2286:8-9 2825:8-9 2946:8-9 3007:8-9 3164:8-9 3238:8-9 3313:8-9 3367:8-9 3580:8-9 3662:8-9 3770:4-5 3841:0-22
 @ ../node_modules/hqchart/index.js
 @ ./src/components/KLine/index.js
 @ ./src/main.js

我看代码/node_modules/hqchart/index.js

//行情图形库
module.exports.Chart = require('./src/jscommon/umychart.vue/umychart.vue.js').default;

//行情股票数据接口类
module.exports.Stock = require('./src/jscommon/umychart.vue/umychart.stock.vue.js').default;

我看是vue的代码,问一下react下使用,正确的方式是什么?

@li-yiang
Copy link
Collaborator

HQChart里面有用到jquery,在你的项目中安装下jquery,就不会报这个错了

@balabalab
Copy link

HQChart里面有用到jquery,在你的项目中安装下jquery,就不会报这个错了

vue-router.esm.js?8c4f:2079 ReferenceError: exports is not defined

业余前端,vue-cli4报错,使用案例的配置没问题,应该是webpack哪里没配置对,倒腾半下午也没弄好,请问我应该怎么做。

@jackhutu
Copy link

请问有解决吗, react下报同样的错误

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

4 participants