微信小程序
小程序基础库: 2.17.0 使用框架: React
复现步骤使用的是react-hook。 按照代码步骤引入的echarts-taro3-react。 demo中使用的是ref,我把他换成了useRef ` import { Component, useRef, useLayoutEffect } from 'react' import { View, Button, Text } from '@tarojs/components' import { observer, inject } from 'mobx-react' import { EChart } from "echarts-taro3-react";
import './index.scss'
const App = () => { const option = { xAxis: { type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { type: 'value' }, series: [{ data: [150, 230, 224, 218, 135, 147, 260], type: 'line' }] };
let barChart: any = null useLayoutEffect(() => { console.log(barChart) barChart.refresh(option) }) const refBarChart = (node) => (barChart = node); return (
) }
export default inject('store')(observer(App)) `
期望结果正常使用,并渲染出结果
实际结果TypeError: r.addEventListener is not a function
环境信息👽 Taro v3.3.1
Taro CLI 3.3.1 environment info:
System:
OS: macOS 11.4
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.4.2 - /usr/local/bin/node
Yarn: 1.22.10 - ~/.npm-global/bin/yarn
npm: 7.19.1 - ~/.npm-global/bin/npm
npmPackages:
@tarojs/components: 3.3.1 => 3.3.1
@tarojs/mini-runner: 3.3.1 => 3.3.1
@tarojs/react: 3.3.1 => 3.3.1
@tarojs/runtime: 3.3.1 => 3.3.1
@tarojs/taro: 3.3.1 => 3.3.1
@tarojs/webpack-runner: 3.3.1 => 3.3.1
babel-preset-taro: 3.3.1 => 3.3.1
eslint-config-taro: 3.3.1 => 3.3.1
react: ^17.0.0 => 17.0.2
npmGlobalPackages:
typescript: 4.3.5