function addScript (url, callback) { const script = document.createElement('script') if (script.readyState) { script.onreadystatechange = () => { if (script.readyState === 'loaded' || script.readyState === 'complete') { script.onreadystatechange = '' callback() } } } else { script.onload = () => { callback() } } script.src = url document.head.appendChild(script) }
插入js
猜你喜欢
转载自www.cnblogs.com/chenmingxu/p/10538374.html
今日推荐
周排行