[英]Add an event listener for the loading of an API
The problem is that is can't find how to do that.问题是找不到如何做到这一点。
Here is the code for load the API:这是加载 API 的代码:
const Butter = require('buttercms')
export const butter = Butter('your-api-token')
For this you can load the script dynamically when your api will return response
after that script tag will be loaded.
fetch("url").then(
var Script = document.createElement('script');
Script.setAttribute('src','your script url');
document.head.appendChild(Script);
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.