2017-08-08 58 views
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” 的错误。

回答

相关问题