<!DOCTYPE html>
...
<head>
<script type="module">
import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate';
const el = document.createElement('pwa-update');
document.body.appendChild(el);
</script>
...
</head>根据本文档(https://github.com/pwa-builder/pwabuilder-web/blob/V2/src/assets/next-steps.md),我试图将PWA应用到我的站点。但是,这并没有达到预期的效果,在查看浏览器的调试工具时,我发现我需要更改swpath的值。
我尝试过各种方法来更改swpath的值,但是失败了,存储库只声明swpath的值存在,但没有告诉我如何更改它。我想知道如何更改swpath的值。
发布于 2022-01-26 05:01:22
<!DOCTYPE html>
<head>
...
<script type="module">
import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate';
const el = document.createElement('pwa-update');
el.swpath = "/pwabuilder-sw.js";
document.body.appendChild(el);
</script>
...
</head>我用上面的代码解决了问题。
https://stackoverflow.com/questions/70855323
复制相似问题