nw.js 将vue build 后的项目封装成exe

执行exe 后仍是之前的版本 原因是nw.js 存在缓存

解决方法

在index.html 下 增加以下代码

try{
    window.nw.App.clearCache();
    window.chrome.browsingData.remove({
        since: 0
    }, {
        appcache: true,
        cache: true,
        cookies: true,
        downloads: true,
        fileSystems: true,
        formData: true,
        history: true,
        indexedDB: true,
        localStorage: true,
        pluginData: true,
        passwords: true,
        serverBoundCertificates: true,
        serviceWorkers: true,
        webSQL: true
    }, function () {
        console.log('clear cache success!!!')
    });
} catch (e) {
    alert(e)
}
最后修改:2023 年 03 月 23 日
如果觉得我的文章对你有用,请随意赞赏