Chessboardjs NPM 包,未显示图像 [英] Chessboardjs NPM package, not showing images
问题描述
我正在尝试使用 https://www.npmjs.com/package/chessboardjs与流星 1.13 一起打包.我编写了简单的反应组件来渲染电路板,但由于某种原因它不渲染图像.组件代码:
从 'react' 导入 React从 'chessboardjs' 导入 ChessBoard导出默认类 GamePage 扩展 React.Component {使成为() {返回 (<div><div id="chessboard" style={{"width": "400px"}}></div>
)}componentDidMount() {var board = ChessBoard('棋盘');}}
我看到该包中的 .css 没有被使用,所以也许我也必须以某种方式导入它?
那么 chessboard.js 的资产是存储在静态的某个地方,对吧?有一个关于 Flask
的问题可能有你的答案,
这个想法是修改 chessboard.js
库,其中 src
是棋盘的图像.
如果它不起作用,请记住清除缓存,因为浏览器将保留未编辑的库.
I am trying to use https://www.npmjs.com/package/chessboardjs package with meteor 1.13. I wrote simple react component to render the board, but it doesn't render images for some reason. The compoent code:
import React from 'react'
import ChessBoard from 'chessboardjs'
export default class GamePage extends React.Component {
render() {
return (
<div>
<div id="chessboard" style={{"width": "400px"}}></div>
</div>
)
}
componentDidMount() {
var board = ChessBoard('chessboard');
}
}
I see that .css from that package is not being used, so maybe I have to import it as well somehow?
So the assets for chessboard.js are stored somewhere in static, right? There's a question out there about Flask
which might have your answer,
Integrate chessbord.js with Flask
The idea is to modify the chessboard.js
library, where it src
the images for the board.
Remember to clear your cache if it's not working, as the browser will hold onto to the unedited library.
这篇关于Chessboardjs NPM 包,未显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!