Coder Social home page Coder Social logo

zjq1394288160 / vue-mpc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sknightq/vue-mpc

0.0 1.0 0.0 167 KB

multiple pages (multiple entries) based on vue-cli with respective router(基于vue-cli创建的多页面应用,每个页面入口又可以创建自己的vue-router)

Home Page: http://www.sknight.cn:82/

JavaScript 85.27% HTML 5.06% CSS 0.64% Vue 9.03%

vue-mpc's Introduction

vue-mpc

multiple pages (multiply entries) based on vue-cli
基于vue-cli的多入口(多页面)前端项目框架,每个入口页面可以调用自身的vue-router来达到自身页面的前端路由跳转
vue 版本为2.5.2,修改了config和build里的多个文件
样式使用了scss, 未引入多余的ui

tips

Because this is a multiple pages, there must be have the condition that pass params between two pages
由于这个是多页面的项目,肯定存在多页面之间传数据的情况
公司项目结构是这些d多页面的vue都是用iframe包着
Current Solution (当前解决方式):

  import Vue from 'vue'  
  import axios from 'axios'  
  import VueAxios from 'vue-axios'  
  import listApp from '@/views/rescue/list/listApp'  

  import '@/assets/styles/scss/normalize.scss'  

  Vue.use(VueAxios, axios)  

  const vueInstance = new Vue({  
    el: '#list-app',  
    // router,  
    components: { listApp },  
    template: '<list-app/>'  
  })  

  window.refreshRescueList = function() {  
    // 获得listApp组件上下文,用于修改组件数据,并自动更新view 因为这个是list入口文件,其子组件只有一个listApp  
    // get the context of listApp components, in order to update the data of this component and then can render the view  
    listApp.methods.refreshList.apply(vueInstance.$children[0], arguments)  
  }  

expose a global (mount on window) method in current page (暴露一个全局的方法,挂在再window对象上)
other pages can get the method through the iframe (其他页面就可以通过iframe去获取这个页面的相关组件的方法)
欢迎提出其他解决方案

update

2018.4.13
1.增加了scss全局文件引入,可用于在组件里直接使用公共样式变量
2.现在可以监听多目录(不单单只有views目录,可以自己在config/index.js配置)

todo

index.html页面似乎热启动有问题
增加scss变量引入(完成) 验证vuex状态多页面之间是否共用

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# serve with hot reload at localhost:8080/views/modulea/home.html
# 并且可以监听多页面的修改
npm run mydev

# build for production with minification
npm run build

# build for production and view the bundle analyzer report
npm run build --report

# run unit tests
npm run unit

# run e2e tests
npm run e2e

# run all tests
npm test

For a detailed explanation on how things work, check out the guide and docs for vue-loader.

vue-mpc's People

Watchers

James Cloos 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.