Code Monkey home page Code Monkey logo

basedesktopapp's Introduction

Base Desktop App

electron + vue + element UI = excellent desktop app

code style: prettier

为你的工具快速构建一个界面

目的

  • 在日常工作中,经常需要开发一些小工具用于简化流程以提升开发效率
  • 这些小工具通常都比较零碎,需要一个有效的手段将他们聚合在一起,这种手段通常是GUI
  • 而GUI的开发是很繁琐的,如果投入很多时间到开发GUI上难免本末倒置。而语言原生的GUI通常都非常丑
  • 这套模板针对这种情况被设计出来

选型

  • electron 将前端技术应用到桌面应用的开发中,利用前端技术开发桌面应用成为可能
  • vue 大大降低了前端入门门槛,让其他方向的工程师也能够快速上手
  • element UI 作为vue系列中知名的组件库,让工程师也能够独立开发出美观的界面
  • node 环境提供了与系统交互的能力,能够整合其他已有的工具

设计

  • 标题栏仿照MacOS制作,在全平台上表现一致
  • 美观的加载动画与通知弹窗,可以根据需要进行定制
  • 使用方法尽量简单,让开发者能够把更多的精力放在工具本身而不是GUI上

使用

建议是直接fork到自己的github使用,然后就可以随便玩了(?

安装依赖

npm install

运行

在环境配置完毕之后,执行:

npm run dev

如果环境没有错误的话,应该可以看到app已经被正常拉起了。

如何关联现有的工具

首先我们需要新增一个页面:

  • 在pages中新增vue文件,例如新增一个example模块:
    • 创建example文件夹
    • 在里面创建Example.vue文件
  • 在components/SideBar.vue中仿照其他项目新增
    • <el-menu-item index="/example"><i class="el-icon-edit"></i>例子</el-menu-item>
  • 在router/index.js中仿照其他项目新增
    • {path: '/example', component: 'Example'},

这样就可以看到在侧边栏中已经有新增的项目了。

假设我们需要加入的是一个 python 脚本(比如放置在根目录的 example文件夹 中),你只需要在 Example.vue 下新增方法:

this.$execCmd(
    // 命令行怎么运行它就怎么写
    `python ./example/example.py`,
    // 加载动效的文字
    "运行python example :)",
    // 结果存放,如果按默认设定,在执行完成后: 
    // `this['cmdResult'] = result`
    'cmdResult',
)

然后点击运行:

就可以啦!

依赖项目

BUG与建议

欢迎issue。(也欢迎star/fork

basedesktopapp's People

Contributors

williamfzc avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.