动态插入css

function loadStyle(url) {
  const link = document.createElement('link');
  link.type = 'text/css';
  link.rel = 'stylesheet';
  link.href = url;
  const head = document.getElementsByTagName('head')[0];
  head.appendChild(link);
};

  

原文地址:https://www.cnblogs.com/wangyunhui/p/12712781.html