Comments (1)
import lottie from "lottie-miniprogram";
改成用这个就正常了
useReady(() => {
Taro.createSelectorQuery().select('#canvas').node((ref) => {
if(ref){
const canvas = ((ref as unknown as unknown[]).length > 0)? ref[0].node: ref.node;
if(canvas){
const context = canvas.getContext('2d');
lottie.setup(canvas)
lottie.loadAnimation({
animationData: require("assets/react.json"),
loop: true,
autoplay: true,
rendererSettings: {context},
});
}
}
}).exec();
})
<View className='right-content'>
{/* 右边的内容 */}
<Canvas id='canvas' className={`right-image ${isDisabled ? 'disabled' : ''}`}
type='2d' onTouchStart={handleClick} onTouchEnd={handleReleaseClick} onClick={() => {
}}
/>
</View>
from taro-visualization.
Related Issues (9)
- taro-charts的npm包不可用 HOT 1
- 如果我只有svg或者skia其中的一个包会报错
- 小程序占用了太多代码空间 HOT 2
- 小程序端卸载的时候报错 HOT 1
- 小程序上一个页面同时调用多个图表,只显示第一个 HOT 1
- 小程序监听事件不触发
- taro-echarts
- H5报错,需要修改如下 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taro-visualization.