当前位置: 首页 > 软件库 > Web应用开发 > >

vue-fullstack

vue fullstack template
授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发
软件类型 开源软件
地区 不详
投 递 者 辛麻雀
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Vue fullstack template

MIT Licence

This project's goal is to help people create a reactive, realtime and user friendly backend system. ��

Vue version

This template only support vue2, because it use ElementUI as the default ui library and ElementUI just support vue2.

Requirement

  • Mongodb This project requires mongodb as the database. You can follow it's tutorial to install it if you haven't installed it already. In consideration of the recent mongodb attack event, it's highly recommend to enable auth and disable public login for your mongodb.
  • Basic vue.js skills

About mock and i18n

If you chose to use mock server or not use i18n at project initialization, you need to take a look at this description, else you can skip this step.
As vue-cli does't support to run a task after initialization, you need to run npm run remove:i18n(This script doesn't change the page view which contains change locale in client/src/components/Header.vue and client/src/view/auth/Login.vue, you can remove that code manually.) and npm run remove:mock manually.

Usage

This is a project template for vue-cli. It is recommended to use npm 3+ for a more efficient dependency tree.

# cli version must be greater than 2.8.0
$ npm install -g vue-cli
$ vue init erguotou520/vue-fullstack my-project ## (important hint: don't use a dot in your project name, otherwise it will cause issues with mongodb)
$ cd my-project
$ npm install
# If you chose to use mock server, you need to run remove:mock to change the file structure, otherwise just skip this step
$ npm run remove:mock
# If you chose not to use vue-i18n, you need to run remove:i18n to replace the files with default locale text, otherwise just skip this step
$ npm run remove:i18n
# If you chose to use real backend server, run this script to start an express server
$ npm run server
# If you chose to use mock server, run this script to start a mock server
$ npm run mock
# Open another terminal and cd into my-project
# This runs a frontend dev server
$ npm run client

What's Included

  • vue
  • vue-router
  • vuex
  • vue-i18n
  • vue-resource
  • element-ui
  • express
  • mongoose
  • socket.io
  • mock server

Demo app

* Here is a demo and the demo repo is here
* This is another one

Now the demo apps are generated by ci automatically and pushed to vf-backend|vf-mock branches.

Do not change the password please.

username: admin
password: admin

App structure

├─client               # frontend source folder
│  ├─build             # frontend dev scripts
│  ├─src               # frontend src
│  │  ├─assets
│  │  │  ├─css
│  │  │  ├─fonts
│  │  │  └─images
│  │  ├─components     # vue components
│  │  ├─http           # vue-resource configuration
│  │  ├─locale         # vue-i18n configuration
│  │  ├─router         # vue-router configuration
│  │  ├─socket         # socket.io configuration
│  │  ├─storage        # web storage api
│  │  ├─store          # vuex store
│  │  │  └─modules
│  │  └─view           # app pages
│  │     └─auth
│  └─static            # static folder
├─mock                 # mock server
│  ├─ajax              # ajax mock configs
│  ├─socket            # socket.io mock configs
└─server               # backend server folder
    ├─api              # backend api list
    │  ├─thing
    │  └─user
    ├─auth             # user auth logical
    │  └─local
    ├─components       # server components
    │  └─errors
    ├─config           # server configs, contains express socket.io, etc.
    └─views            # server served pages

Configuration

Most of the configuration is concentrated in the config.js file and most of them have explicit comments. You need to take a look at it first.

Here are some important/frequently-used configurations:

  • frontend.port port that frontend server listens at
  • backend.port port that backend server listen at
  • backend.secrets.session secret for session, important when you deploy your app, make sure it's complex enough
  • backend.mongo.uri change this if your mongodb uri is not matched
  • backend.serverFrontend whether to server the frontend code. If set to true the express server serves the frontend code. Otherwise you may need a http server like nginx to serve frontend code and there is a nginx configuration at nginx.example.conf (default true)

Environment variables

When you deploy your app to you cloud server it's easy to configure youre app with environment variables. Following are supported:

  • APP_port or PORT: set to backend.port
  • APP_HOST or APP_IP or HOST or IP: set to backend.ip
  • MONGODB_URI or MONGOHQ_URI: set to backend.mongo.uri
  • SECRET: set to backend.secrets.session

Notice

The generated app is just a template to build your app system fast. Maybe it can't meet your needs, so you need to do some changes at this issue.

License

Under MIT license

Reference resources

At the end

I am very glad to receive your suggestions and pull request.

 相关资料
  • 构造器 每个 Vue.js 应用都是通过构造函数 Vue 创建一个 Vue 的根实例 启动的: var vm = new Vue({ // 选项 }) 虽然没有完全遵循 MVVM 模式, Vue 的设计无疑受到了它的启发。因此在文档中经常会使用 vm 这个变量名表示 Vue 实例。 在实例化 Vue 时,需要传入一个选项对象,它可以包含数据、模板、挂载元素、方法、生命周期钩子等选项。全部的选

  • vue

    教程简介 本教程要实现一个简单的后台管理系统,包含登陆、数据列表、数据查询、列表分页、添加数据、修改数据和删除数据等功能,教程会从 Vue 入门开始讲解,包含 es6、Sass、Webpack、Bootstrap、jQuery 等技术,再到后台管理系统的一些常规功能,用 Vue 如何去实现。 也许会有人质疑 Vue 和 jQuery 的搭配,在我本人看来,jQuery 本身已很成熟,而且包含了很多

  • FAQ 哇,非常长的一页!是否意味着 Vue 2.0 已经完全不同了呢,是否需要从头学起呢,Vue 1.0 的项目是不是没法迁移了? 非常开心地告诉你,并不是!几乎 90% 的 API 和核心概念都没有变。因为本节包含了很多详尽的阐述以及许多迁移的例子,所以显得有点长。不用担心,你不必从头到尾把本节读一遍! 我该从哪里开始项目迁移呢? 首先,在当前项目下运行迁移工具。我们非常谨慎地把高级 Vue

  • Integration with Vue is easily done with the @tinymce/tinymce-vue package. To use it, install it with npm like this: npm install @tinymce/tinymce-vue For information on how to use the package, check

  • 本规范提供了一种统一的编码规范来编写 Vue.js 代码。这使得代码具有如下的特性: 其它开发者或是团队成员更容易阅读和理解。 IDEs 更容易理解代码,从而提供高亮、格式化等辅助功能 更容易使用现有的工具 更容易实现缓存以及代码包的分拆 要点 尽量使用ES2015,遵循CommonJs规范 切勿直接操作DOM,所以也应该避免使用jQuery库 data属性一定要是一个函数并且返回一个json对象

  • 全局配置 Vue.config 是一个对象,包含 Vue 的全局配置。可以在启动应用之前修改下列属性: silent 类型: boolean 默认值: false 用法: Vue.config.silent = true 取消 Vue 所有的日志与警告。 optionMergeStrategies 类型: { [key: string]: Function } 默认值: {} 用法: Vue.c

  • MVVM MVVM双向数据绑定是通过数据劫持+发布订阅模式Object.defineProperty let obj={}; let theValue; Object.defineProperty(obj,'theKeyName',{ //value:'theValue', configurable:true, //可以配置对象,删除属性 //writable:true

  • Highcharts Vue 是我们基于 Vue 框架封装的 Highcharts,可以很方便的在 Vue 开发环境中使用 Highcharts 创建交互性图表。 开发环境 已经全局安装 Node.js, NPM Vue, Highcharts 库已经安装在项目中 通过 npm 安装 Highcharts 下载安装 安装 highcharts-vue npm install highcharts-