Skip to content
/ vue-electron Public template

Vue多端脚手架,支持Web、桌面端

Notifications You must be signed in to change notification settings

dvgis/vue-electron

Repository files navigation

Vue-Electron

🇨🇳 中文 | 🇬🇧English

该脚手架基于 VueCli4 、 vue-cli-plugin-electron-builder,用于快速构建 Vue 桌面端应用。

启动

yarn run serve
yarn run electron:serve

打包

yarn run build
yarn run electron:build

配置说明

module.exports = {
  // 其他配置
  chainWebpack: config => {},
  pluginOptions: {
    electronBuilder: {
      chainWebpackMainProcess: config => {},
      chainWebpackRendererProcess: config => {
        config.plugin('define').tap(args => {
          const env = args[0]['process.env']
          for (let key in env) {
            args[0][`process.env.${key}`] = env[key]
          }
          delete args[0]['process.env']
          return args
        })
      }
    }
  }
}

全局变量 Config

获取对应配置文件赋予的值

桌面端: 当前用户目录下的 .vue-conf/config.json

Web 端: 项目目录下的 public/config/config.json

示例

pic