jones2000 / HQChart

HQChart - H5, 微信小程序 沪深/港股/数字货币/期货/美股 K线图(kline),走势图,缩放,拖拽,十字光标,画图工具,截图,筹码图. 分析家语法,通达信语法,(麦语法),第3方数据替换接口
https://jones2000.github.io/HQChart/webhqchart.demo/samples/kline_index_edit.html
Apache License 2.0
2.91k stars 747 forks source link

react 下使用问题 #4

Open superwunc opened 5 years ago

superwunc commented 5 years ago

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 commented 5 years ago

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

balabalab commented 4 years ago

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

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

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

jackhutu commented 7 months ago

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