0
我正在寫一個使用反應的api門戶,並希望在反應組件中包含Redoc(https://github.com/Rebilly/ReDoc)。是否可以在反應中使用Redoc?如果是的話,那麼做這件事的最好方法是什麼?如何在React應用中包含Redoc?
我試過通過全局暴露的Redoc對象初始化ReDoc,但它拋出esprima和jquery缺少錯誤。我已經安裝了這些軟件包,但仍然沒有運氣。
import {Redoc} from './redoc';
module.exports = Redoc;
Redoc.init('http://petstore.swagger.io/v2/swagger.json', {
scrollYOffset: 50
})
另外,如果我有在組件直接
render() {
return(
<div>
<redoc spec-url='http://petstore.swagger.io/v2/swagger.json'>
</redoc>
</div>
);
}
它拋出 「關於標籤未知道具spec-url
」 的錯誤。