Showing
39 changed files
with
9 additions
and
988 deletions
| ... | @@ -2,18 +2,6 @@ var dev = [ | ... | @@ -2,18 +2,6 @@ var dev = [ |
| 2 | { | 2 | { |
| 3 | title: '登录页', | 3 | title: '登录页', |
| 4 | page: 'login' | 4 | page: 'login' |
| 5 | - }, | ||
| 6 | - { | ||
| 7 | - title: 'A', | ||
| 8 | - page: 'A' | ||
| 9 | - }, | ||
| 10 | - { | ||
| 11 | - title: 'B', | ||
| 12 | - page: 'B' | ||
| 13 | - }, | ||
| 14 | - { | ||
| 15 | - title: 'C', | ||
| 16 | - page: 'C' | ||
| 17 | } | 5 | } |
| 18 | ]; | 6 | ]; |
| 19 | 7 | ... | ... |
| ... | @@ -2,18 +2,6 @@ var prod = [ | ... | @@ -2,18 +2,6 @@ var prod = [ |
| 2 | { | 2 | { |
| 3 | title: '登录页', | 3 | title: '登录页', |
| 4 | page: 'login' | 4 | page: 'login' |
| 5 | - }, | ||
| 6 | - { | ||
| 7 | - title: 'A', | ||
| 8 | - page: 'A' | ||
| 9 | - }, | ||
| 10 | - { | ||
| 11 | - title: 'B', | ||
| 12 | - page: 'B' | ||
| 13 | - }, | ||
| 14 | - { | ||
| 15 | - title: 'C', | ||
| 16 | - page: 'C' | ||
| 17 | } | 5 | } |
| 18 | ]; | 6 | ]; |
| 19 | 7 | ... | ... |
public/A.html
deleted
100644 → 0
| 1 | -<!DOCTYPE html> | ||
| 2 | -<html lang="en"> | ||
| 3 | - <head> | ||
| 4 | - <meta charset="utf-8"> | ||
| 5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| 6 | - <meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
| 7 | - <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
| 8 | - <!-- 使用CDN加速的CSS文件,配置在vue.config.js下 --> | ||
| 9 | - <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %> | ||
| 10 | - <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style"> | ||
| 11 | - <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet"> | ||
| 12 | - <% } %> | ||
| 13 | - | ||
| 14 | - <title><%= htmlWebpackPlugin.options.title %></title> | ||
| 15 | - | ||
| 16 | - <!-- 使用CDN加速的JS文件,配置在vue.config.js下 --> | ||
| 17 | - <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %> | ||
| 18 | - <script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script"></script> | ||
| 19 | - <% } %> | ||
| 20 | - </head> | ||
| 21 | - <body> | ||
| 22 | - <noscript> | ||
| 23 | - <strong>We're sorry but test1 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | ||
| 24 | - </noscript> | ||
| 25 | - <div id="A"></div> | ||
| 26 | - <!-- built files will be auto injected --> | ||
| 27 | - </body> | ||
| 28 | -</html> |
public/B.html
deleted
100644 → 0
| 1 | -<!DOCTYPE html> | ||
| 2 | -<html lang="en"> | ||
| 3 | - <head> | ||
| 4 | - <meta charset="utf-8"> | ||
| 5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| 6 | - <meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
| 7 | - <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
| 8 | - <!-- 使用CDN加速的CSS文件,配置在vue.config.js下 --> | ||
| 9 | - <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %> | ||
| 10 | - <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style"> | ||
| 11 | - <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet"> | ||
| 12 | - <% } %> | ||
| 13 | - | ||
| 14 | - <title><%= htmlWebpackPlugin.options.title %></title> | ||
| 15 | - | ||
| 16 | - <!-- 使用CDN加速的JS文件,配置在vue.config.js下 --> | ||
| 17 | - <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %> | ||
| 18 | - <script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script"></script> | ||
| 19 | - <% } %> | ||
| 20 | - </head> | ||
| 21 | - <body> | ||
| 22 | - <noscript> | ||
| 23 | - <strong>We're sorry but test1 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | ||
| 24 | - </noscript> | ||
| 25 | - <div id="B"></div> | ||
| 26 | - <!-- built files will be auto injected --> | ||
| 27 | - </body> | ||
| 28 | -</html> |
public/C.html
deleted
100644 → 0
| 1 | -<!DOCTYPE html> | ||
| 2 | -<html lang="en"> | ||
| 3 | - <head> | ||
| 4 | - <meta charset="utf-8"> | ||
| 5 | - <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
| 6 | - <meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
| 7 | - <link rel="icon" href="<%= BASE_URL %>favicon.ico"> | ||
| 8 | - <!-- 使用CDN加速的CSS文件,配置在vue.config.js下 --> | ||
| 9 | - <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %> | ||
| 10 | - <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style"> | ||
| 11 | - <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet"> | ||
| 12 | - <% } %> | ||
| 13 | - | ||
| 14 | - <title><%= htmlWebpackPlugin.options.title %></title> | ||
| 15 | - | ||
| 16 | - <!-- 使用CDN加速的JS文件,配置在vue.config.js下 --> | ||
| 17 | - <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %> | ||
| 18 | - <script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>" rel="preload" as="script"></script> | ||
| 19 | - <% } %> | ||
| 20 | - </head> | ||
| 21 | - <body> | ||
| 22 | - <noscript> | ||
| 23 | - <strong>We're sorry but test1 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> | ||
| 24 | - </noscript> | ||
| 25 | - <div id="C"></div> | ||
| 26 | - <!-- built files will be auto injected --> | ||
| 27 | - </body> | ||
| 28 | -</html> |
src/multiPages/A/A.js
deleted
100644 → 0
| 1 | -/* jshint esversion: 6 */ | ||
| 2 | -import Vue from 'vue'; | ||
| 3 | -import Vuex from 'vuex'; | ||
| 4 | -import store from './vuex/store'; | ||
| 5 | -import router from './router'; | ||
| 6 | -import VueRouter from 'vue-router'; | ||
| 7 | -import axios from './http'; | ||
| 8 | -import A from './A.vue'; | ||
| 9 | -import { sync } from 'vuex-router-sync'; | ||
| 10 | -import FastClick from 'fastclick'; | ||
| 11 | -import Vant from 'vant'; | ||
| 12 | -import 'vant/lib/index.css'; | ||
| 13 | - | ||
| 14 | -sync(store, router); | ||
| 15 | -Vue.use(VueRouter); | ||
| 16 | -Vue.use(Vuex); | ||
| 17 | -Vue.use(Vant); | ||
| 18 | - | ||
| 19 | -Vue.config.productionTip = false; | ||
| 20 | -Vue.prototype.method = function () {}; | ||
| 21 | - | ||
| 22 | -FastClick.attach(document.body); | ||
| 23 | - | ||
| 24 | -new Vue({ | ||
| 25 | - store, | ||
| 26 | - router, | ||
| 27 | - axios, | ||
| 28 | - render: h => h(A) | ||
| 29 | -}).$mount('#A'); |
src/multiPages/A/A.vue
deleted
100644 → 0
| 1 | -<template lang="html"> | ||
| 2 | - <div id="A" style="height:100%;"> | ||
| 3 | - <router-view style="margin-top: 3rem"></router-view> | ||
| 4 | - </div> | ||
| 5 | -</template> | ||
| 6 | - | ||
| 7 | -<script> | ||
| 8 | -import { mapState } from 'vuex' | ||
| 9 | -export default { | ||
| 10 | - components: {}, | ||
| 11 | - data () { | ||
| 12 | - return { | ||
| 13 | - isIndex: true, | ||
| 14 | - showMore: true | ||
| 15 | - } | ||
| 16 | - }, | ||
| 17 | - computed: { | ||
| 18 | - ...mapState({ | ||
| 19 | - title: state => state.title | ||
| 20 | - }) | ||
| 21 | - }, | ||
| 22 | - watch: { | ||
| 23 | - $route: 'fetchData' | ||
| 24 | - }, | ||
| 25 | - mounted () { | ||
| 26 | - }, | ||
| 27 | - methods: { | ||
| 28 | - fetchData () { | ||
| 29 | - if (this.$route.meta.isIndex) { | ||
| 30 | - this.isIndex = true | ||
| 31 | - } else { | ||
| 32 | - this.isIndex = false | ||
| 33 | - } | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | -} | ||
| 37 | -</script> | ||
| 38 | - | ||
| 39 | -<style lang="less"> | ||
| 40 | - html, body { | ||
| 41 | - font-family: '微软雅黑', Microsoft YaHei; | ||
| 42 | - height: 100%; | ||
| 43 | - width: 100%; | ||
| 44 | - overflow-x: hidden; | ||
| 45 | - background-color: #F0EFF5; | ||
| 46 | - #login { | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | -</style> |
src/multiPages/A/http.js
deleted
100644 → 0
| 1 | -/* jshint esversion: 6 */ | ||
| 2 | -import axios from 'axios' | ||
| 3 | -import router from './router' | ||
| 4 | - | ||
| 5 | -// 请求拦截器 | ||
| 6 | -axios.interceptors.request.use( | ||
| 7 | - config => { | ||
| 8 | - // 发送请求前 | ||
| 9 | - return config | ||
| 10 | - }, | ||
| 11 | - error => { | ||
| 12 | - // 请求错误处理 | ||
| 13 | - return Promise.reject(error) | ||
| 14 | - }) | ||
| 15 | - | ||
| 16 | -// 响应拦截器 | ||
| 17 | -axios.interceptors.response.use( | ||
| 18 | - response => { | ||
| 19 | - return response | ||
| 20 | - }, | ||
| 21 | - error => { | ||
| 22 | - if (error.response) { | ||
| 23 | - switch (error.response.status) { | ||
| 24 | - case 401: | ||
| 25 | - router.replace({ | ||
| 26 | - path: '/' | ||
| 27 | - }) | ||
| 28 | - break | ||
| 29 | - case 404: | ||
| 30 | - router.replace({ | ||
| 31 | - path: '/' | ||
| 32 | - }) | ||
| 33 | - break | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | - return Promise.reject(error.response.data) | ||
| 37 | - }) | ||
| 38 | - | ||
| 39 | -export default axios |
src/multiPages/A/route.js
deleted
100644 → 0
src/multiPages/A/router.js
deleted
100644 → 0
| 1 | -/* jshint esversion: 6 */ | ||
| 2 | -import Vue from 'vue' | ||
| 3 | -import VueRouter from 'vue-router' | ||
| 4 | -import ConfigRouter from './route.js' | ||
| 5 | -import store from './vuex/store' | ||
| 6 | - | ||
| 7 | -Vue.use(VueRouter) | ||
| 8 | - | ||
| 9 | -const router = new VueRouter({ | ||
| 10 | - history: false, | ||
| 11 | - hashbang: true, | ||
| 12 | - base: __dirname, | ||
| 13 | - routes: ConfigRouter | ||
| 14 | -}) | ||
| 15 | - | ||
| 16 | -router.beforeEach((to, from, next) => { | ||
| 17 | - store.commit('updateLoadingStatus', true) | ||
| 18 | - next() | ||
| 19 | -}) | ||
| 20 | - | ||
| 21 | -router.afterEach((to, from, next) => { | ||
| 22 | - store.commit('updateLoadingStatus', false) | ||
| 23 | -}) | ||
| 24 | - | ||
| 25 | -export default router |
| 1 | -function initFontSize (baseFontSize, baseWidth) { | ||
| 2 | - let clientWidth = document.documentElement.clientWidth || window.innerWidth() | ||
| 3 | - let size = Math.floor(clientWidth / baseWidth * baseFontSize) | ||
| 4 | - document.querySelector('html').style.fontSize = size + 'px' | ||
| 5 | -} | ||
| 6 | -initFontSize(100, 1080) | ||
| 7 | -window.onresize = function () { | ||
| 8 | - initFontSize(100, 1080) | ||
| 9 | -} |
src/multiPages/A/views/login.vue
deleted
100644 → 0
| 1 | -<template> | ||
| 2 | - <div> | ||
| 3 | - <!-- <van-password-input | ||
| 4 | - :value="value" | ||
| 5 | - info="密码为6位数字" | ||
| 6 | - @focus="keyboard = 'custom'" | ||
| 7 | - /> --> | ||
| 8 | - <van-field v-model="value" :maxlength="10" @click.native="keyboard = 'custom'" @blur="onBlur" readonly placeholder="请输入用户名" /> | ||
| 9 | - <!-- <van-number-keyboard | ||
| 10 | - :show="showKeyboard" | ||
| 11 | - @input="onInput" | ||
| 12 | - @delete="onDelete" | ||
| 13 | - @blur="showKeyboard = false" | ||
| 14 | - /> --> | ||
| 15 | - <van-number-keyboard | ||
| 16 | - :show="keyboard === 'custom'" | ||
| 17 | - close-button-text="完成" | ||
| 18 | - theme="custom" | ||
| 19 | - extra-key="." | ||
| 20 | - @blur="keyboard = ''" | ||
| 21 | - @input="onInput" | ||
| 22 | - @delete="onDelete" | ||
| 23 | - @close="onClose" | ||
| 24 | - /> | ||
| 25 | - </div> | ||
| 26 | -</template> | ||
| 27 | - | ||
| 28 | -<script> | ||
| 29 | -export default { | ||
| 30 | - mounted () { | ||
| 31 | - }, | ||
| 32 | - data () { | ||
| 33 | - return { | ||
| 34 | - value: '', | ||
| 35 | - showKeyboard: true, | ||
| 36 | - keyboard: 'default' | ||
| 37 | - } | ||
| 38 | - }, | ||
| 39 | - methods: { | ||
| 40 | - onInput (key) { | ||
| 41 | - this.value = (this.value + key).slice(0, 5) | ||
| 42 | - }, | ||
| 43 | - onDelete () { | ||
| 44 | - this.value = this.value.slice(0, this.value.length - 1) | ||
| 45 | - }, | ||
| 46 | - onBlur () { | ||
| 47 | - // console.warn(this.value); | ||
| 48 | - }, | ||
| 49 | - onClose () { | ||
| 50 | - this.keyboard = false | ||
| 51 | - } | ||
| 52 | - } | ||
| 53 | -} | ||
| 54 | -</script> | ||
| 55 | - | ||
| 56 | -<style lang="less" scoped> | ||
| 57 | -.login { | ||
| 58 | - position: absolute; | ||
| 59 | - top: 25%; | ||
| 60 | - left: 50%; | ||
| 61 | - transform: translateX(-50%); | ||
| 62 | - padding: 1.8rem 2.5rem; | ||
| 63 | - width: 15rem; | ||
| 64 | - button { | ||
| 65 | - margin-top: 1.2rem; | ||
| 66 | - position: absolute; | ||
| 67 | - right: 2.5rem; | ||
| 68 | - } | ||
| 69 | - input { | ||
| 70 | - display: block; | ||
| 71 | - width: 95%; | ||
| 72 | - padding: 0.8rem 0.4rem; | ||
| 73 | - background: #fff; | ||
| 74 | - border: 1px solid #d6d7dc; | ||
| 75 | - font-size: 0.95rem; | ||
| 76 | - } | ||
| 77 | -} | ||
| 78 | -</style> |
src/multiPages/A/vuex/actions.js
deleted
100644 → 0
src/multiPages/A/vuex/getters.js
deleted
100644 → 0
src/multiPages/A/vuex/store.js
deleted
100644 → 0
| 1 | -import Vue from 'vue' | ||
| 2 | -import Vuex from 'vuex' | ||
| 3 | -import * as actions from './actions' | ||
| 4 | -import * as getters from './getters' | ||
| 5 | - | ||
| 6 | -Vue.use(Vuex) | ||
| 7 | - | ||
| 8 | -// 应用初始状态 | ||
| 9 | -const state = { | ||
| 10 | - isLoading: false, | ||
| 11 | - title: '登录', | ||
| 12 | - form: '', | ||
| 13 | - direction: 'forward' | ||
| 14 | -} | ||
| 15 | - | ||
| 16 | -// 定义所需的 mutations | ||
| 17 | -const mutations = { | ||
| 18 | - updateLoadingStatus (state, status) { | ||
| 19 | - state.isLoading = status | ||
| 20 | - }, | ||
| 21 | - changeTitle (state, title) { | ||
| 22 | - state.title = title | ||
| 23 | - }, | ||
| 24 | - savedForm (state, form) { | ||
| 25 | - state.form = form | ||
| 26 | - }, | ||
| 27 | - UPDATE_DIRECTION (state, direction) { | ||
| 28 | - state.direction = direction | ||
| 29 | - } | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | -// 创建 store 实例 | ||
| 33 | -export default new Vuex.Store({ | ||
| 34 | - actions, | ||
| 35 | - getters, | ||
| 36 | - state, | ||
| 37 | - mutations | ||
| 38 | -}) |
src/multiPages/B/B.js
deleted
100644 → 0
| 1 | -// 多页面测试入口文件 | ||
| 2 | -import Vue from 'vue' | ||
| 3 | -import Vuex from 'vuex' | ||
| 4 | -import store from './vuex/store' | ||
| 5 | -import router from './router' | ||
| 6 | -import VueRouter from 'vue-router' | ||
| 7 | -import axios from './http' | ||
| 8 | -import B from './B.vue' | ||
| 9 | -import { sync } from 'vuex-router-sync' | ||
| 10 | -import FastClick from 'fastclick' | ||
| 11 | -import Vant from 'vant' | ||
| 12 | -import 'vant/lib/index.css' | ||
| 13 | - | ||
| 14 | -sync(store, router) | ||
| 15 | -Vue.use(VueRouter) | ||
| 16 | -Vue.use(Vuex) | ||
| 17 | -Vue.use(Vant) | ||
| 18 | - | ||
| 19 | -Vue.config.productionTip = false | ||
| 20 | -Vue.prototype.method = function () {} | ||
| 21 | - | ||
| 22 | -FastClick.attach(document.body) | ||
| 23 | - | ||
| 24 | -new Vue({ | ||
| 25 | - store, | ||
| 26 | - router, | ||
| 27 | - axios, | ||
| 28 | - render: h => h(B) | ||
| 29 | -}).$mount('#B') |
src/multiPages/B/B.vue
deleted
100644 → 0
| 1 | -<template lang="html"> | ||
| 2 | - <div id="B" style="height:100%;"> | ||
| 3 | - <router-view style="margin-top: 3rem"></router-view> | ||
| 4 | - </div> | ||
| 5 | -</template> | ||
| 6 | - | ||
| 7 | -<script> | ||
| 8 | -import { mapState } from 'vuex' | ||
| 9 | -export default { | ||
| 10 | - components: {}, | ||
| 11 | - data () { | ||
| 12 | - return { | ||
| 13 | - isIndex: true, | ||
| 14 | - showMore: true | ||
| 15 | - } | ||
| 16 | - }, | ||
| 17 | - computed: { | ||
| 18 | - ...mapState({ | ||
| 19 | - title: state => state.title | ||
| 20 | - }) | ||
| 21 | - }, | ||
| 22 | - watch: { | ||
| 23 | - $route: 'fetchData' | ||
| 24 | - }, | ||
| 25 | - mounted () { | ||
| 26 | - }, | ||
| 27 | - methods: { | ||
| 28 | - fetchData () { | ||
| 29 | - if (this.$route.meta.isIndex) { | ||
| 30 | - this.isIndex = true | ||
| 31 | - } else { | ||
| 32 | - this.isIndex = false | ||
| 33 | - } | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | -} | ||
| 37 | -</script> | ||
| 38 | - | ||
| 39 | -<style lang="less"> | ||
| 40 | - html, body { | ||
| 41 | - font-family: '微软雅黑', Microsoft YaHei; | ||
| 42 | - height: 100%; | ||
| 43 | - width: 100%; | ||
| 44 | - overflow-x: hidden; | ||
| 45 | - background-color: #F0EFF5; | ||
| 46 | - #login { | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | -</style> |
src/multiPages/B/http.js
deleted
100644 → 0
| 1 | -/* jshint esversion: 6 */ | ||
| 2 | -import axios from 'axios' | ||
| 3 | -import router from './router' | ||
| 4 | - | ||
| 5 | -// 请求拦截器 | ||
| 6 | -axios.interceptors.request.use( | ||
| 7 | - config => { | ||
| 8 | - // 发送请求前 | ||
| 9 | - return config | ||
| 10 | - }, | ||
| 11 | - error => { | ||
| 12 | - // 请求错误处理 | ||
| 13 | - return Promise.reject(error) | ||
| 14 | - }) | ||
| 15 | - | ||
| 16 | -// 响应拦截器 | ||
| 17 | -axios.interceptors.response.use( | ||
| 18 | - response => { | ||
| 19 | - return response | ||
| 20 | - }, | ||
| 21 | - error => { | ||
| 22 | - if (error.response) { | ||
| 23 | - switch (error.response.status) { | ||
| 24 | - case 401: | ||
| 25 | - router.replace({ | ||
| 26 | - path: '/' | ||
| 27 | - }) | ||
| 28 | - break | ||
| 29 | - case 404: | ||
| 30 | - router.replace({ | ||
| 31 | - path: '/' | ||
| 32 | - }) | ||
| 33 | - break | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | - return Promise.reject(error.response.data) | ||
| 37 | - }) | ||
| 38 | - | ||
| 39 | -export default axios |
src/multiPages/B/route.js
deleted
100644 → 0
src/multiPages/B/router.js
deleted
100644 → 0
| 1 | -/* jshint esversion: 6 */ | ||
| 2 | -import Vue from 'vue' | ||
| 3 | -import VueRouter from 'vue-router' | ||
| 4 | -import ConfigRouter from './route.js' | ||
| 5 | -import store from './vuex/store' | ||
| 6 | - | ||
| 7 | -Vue.use(VueRouter) | ||
| 8 | - | ||
| 9 | -const router = new VueRouter({ | ||
| 10 | - history: false, | ||
| 11 | - hashbang: true, | ||
| 12 | - base: __dirname, | ||
| 13 | - routes: ConfigRouter | ||
| 14 | -}) | ||
| 15 | - | ||
| 16 | -router.beforeEach((to, from, next) => { | ||
| 17 | - store.commit('updateLoadingStatus', true) | ||
| 18 | - next() | ||
| 19 | -}) | ||
| 20 | - | ||
| 21 | -router.afterEach((to, from, next) => { | ||
| 22 | - store.commit('updateLoadingStatus', false) | ||
| 23 | -}) | ||
| 24 | - | ||
| 25 | -export default router |
| 1 | -function initFontSize (baseFontSize, baseWidth) { | ||
| 2 | - let clientWidth = document.documentElement.clientWidth || window.innerWidth() | ||
| 3 | - let size = Math.floor(clientWidth / baseWidth * baseFontSize) | ||
| 4 | - document.querySelector('html').style.fontSize = size + 'px' | ||
| 5 | -} | ||
| 6 | -initFontSize(100, 1080) | ||
| 7 | -window.onresize = function () { | ||
| 8 | - initFontSize(100, 1080) | ||
| 9 | -} |
src/multiPages/B/views/login.vue
deleted
100644 → 0
| 1 | -<template> | ||
| 2 | - <div> | ||
| 3 | - <!-- <van-password-input | ||
| 4 | - :value="value" | ||
| 5 | - info="密码为6位数字" | ||
| 6 | - @focus="keyboard = 'custom'" | ||
| 7 | - /> --> | ||
| 8 | - <van-field v-model="value" :maxlength="10" @click.native="keyboard = 'custom'" @blur="onBlur" readonly placeholder="请输入用户名" /> | ||
| 9 | - <!-- <van-number-keyboard | ||
| 10 | - :show="showKeyboard" | ||
| 11 | - @input="onInput" | ||
| 12 | - @delete="onDelete" | ||
| 13 | - @blur="showKeyboard = false" | ||
| 14 | - /> --> | ||
| 15 | - <van-number-keyboard | ||
| 16 | - :show="keyboard === 'custom'" | ||
| 17 | - close-button-text="完成" | ||
| 18 | - theme="custom" | ||
| 19 | - extra-key="." | ||
| 20 | - @blur="keyboard = ''" | ||
| 21 | - @input="onInput" | ||
| 22 | - @delete="onDelete" | ||
| 23 | - @close="onClose" | ||
| 24 | - /> | ||
| 25 | - </div> | ||
| 26 | -</template> | ||
| 27 | - | ||
| 28 | -<script> | ||
| 29 | -export default { | ||
| 30 | - data () { | ||
| 31 | - return { | ||
| 32 | - value: '', | ||
| 33 | - showKeyboard: true, | ||
| 34 | - keyboard: 'default' | ||
| 35 | - } | ||
| 36 | - }, | ||
| 37 | - methods: { | ||
| 38 | - onInput (key) { | ||
| 39 | - this.value = (this.value + key).slice(0, 5) | ||
| 40 | - }, | ||
| 41 | - onDelete () { | ||
| 42 | - this.value = this.value.slice(0, this.value.length - 1) | ||
| 43 | - }, | ||
| 44 | - onBlur () { | ||
| 45 | - // console.warn(this.value); | ||
| 46 | - }, | ||
| 47 | - onClose () { | ||
| 48 | - this.keyboard = false | ||
| 49 | - } | ||
| 50 | - } | ||
| 51 | -} | ||
| 52 | -</script> | ||
| 53 | - | ||
| 54 | -<style lang="less" scoped> | ||
| 55 | -.login { | ||
| 56 | - position: absolute; | ||
| 57 | - top: 25%; | ||
| 58 | - left: 50%; | ||
| 59 | - transform: translateX(-50%); | ||
| 60 | - padding: 1.8rem 2.5rem; | ||
| 61 | - width: 15rem; | ||
| 62 | - button { | ||
| 63 | - margin-top: 1.2rem; | ||
| 64 | - position: absolute; | ||
| 65 | - right: 2.5rem; | ||
| 66 | - } | ||
| 67 | - input { | ||
| 68 | - display: block; | ||
| 69 | - width: 95%; | ||
| 70 | - padding: 0.8rem 0.4rem; | ||
| 71 | - background: #fff; | ||
| 72 | - border: 1px solid #d6d7dc; | ||
| 73 | - font-size: 0.95rem; | ||
| 74 | - } | ||
| 75 | -} | ||
| 76 | -</style> |
src/multiPages/B/vuex/actions.js
deleted
100644 → 0
src/multiPages/B/vuex/getters.js
deleted
100644 → 0
src/multiPages/B/vuex/store.js
deleted
100644 → 0
| 1 | -import Vue from 'vue' | ||
| 2 | -import Vuex from 'vuex' | ||
| 3 | -import * as actions from './actions' | ||
| 4 | -import * as getters from './getters' | ||
| 5 | - | ||
| 6 | -Vue.use(Vuex) | ||
| 7 | - | ||
| 8 | -// 应用初始状态 | ||
| 9 | -const state = { | ||
| 10 | - isLoading: false, | ||
| 11 | - title: '登录', | ||
| 12 | - form: '', | ||
| 13 | - direction: 'forward' | ||
| 14 | -} | ||
| 15 | - | ||
| 16 | -// 定义所需的 mutations | ||
| 17 | -const mutations = { | ||
| 18 | - updateLoadingStatus (state, status) { | ||
| 19 | - state.isLoading = status | ||
| 20 | - }, | ||
| 21 | - changeTitle (state, title) { | ||
| 22 | - state.title = title | ||
| 23 | - }, | ||
| 24 | - savedForm (state, form) { | ||
| 25 | - state.form = form | ||
| 26 | - }, | ||
| 27 | - UPDATE_DIRECTION (state, direction) { | ||
| 28 | - state.direction = direction | ||
| 29 | - } | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | -// 创建 store 实例 | ||
| 33 | -export default new Vuex.Store({ | ||
| 34 | - actions, | ||
| 35 | - getters, | ||
| 36 | - state, | ||
| 37 | - mutations | ||
| 38 | -}) |
src/multiPages/C/C.js
deleted
100644 → 0
| 1 | -// 多页面测试入口文件 | ||
| 2 | -import Vue from 'vue' | ||
| 3 | -import Vuex from 'vuex' | ||
| 4 | -import store from './vuex/store' | ||
| 5 | -import router from './router' | ||
| 6 | -import VueRouter from 'vue-router' | ||
| 7 | -import axios from './http' | ||
| 8 | -import C from './C.vue' | ||
| 9 | -import { sync } from 'vuex-router-sync' | ||
| 10 | -import FastClick from 'fastclick' | ||
| 11 | -import Vant from 'vant' | ||
| 12 | -import 'vant/lib/index.css' | ||
| 13 | - | ||
| 14 | -sync(store, router) | ||
| 15 | -Vue.use(VueRouter) | ||
| 16 | -Vue.use(Vuex) | ||
| 17 | -Vue.use(Vant) | ||
| 18 | - | ||
| 19 | -Vue.config.productionTip = false | ||
| 20 | -Vue.prototype.method = function () {} | ||
| 21 | - | ||
| 22 | -FastClick.attach(document.body) | ||
| 23 | - | ||
| 24 | -new Vue({ | ||
| 25 | - store, | ||
| 26 | - router, | ||
| 27 | - axios, | ||
| 28 | - render: h => h(C) | ||
| 29 | -}).$mount('#C') |
src/multiPages/C/C.vue
deleted
100644 → 0
| 1 | -<template lang="html"> | ||
| 2 | - <div id="C" style="height:100%;"> | ||
| 3 | - <router-view style="margin-top: 3rem"></router-view> | ||
| 4 | - </div> | ||
| 5 | -</template> | ||
| 6 | - | ||
| 7 | -<script> | ||
| 8 | -import { mapState } from 'vuex' | ||
| 9 | -export default { | ||
| 10 | - components: {}, | ||
| 11 | - data () { | ||
| 12 | - return { | ||
| 13 | - isIndex: true, | ||
| 14 | - showMore: true | ||
| 15 | - } | ||
| 16 | - }, | ||
| 17 | - computed: { | ||
| 18 | - ...mapState({ | ||
| 19 | - title: state => state.title | ||
| 20 | - }) | ||
| 21 | - }, | ||
| 22 | - watch: { | ||
| 23 | - $route: 'fetchData' | ||
| 24 | - }, | ||
| 25 | - mounted () { | ||
| 26 | - }, | ||
| 27 | - methods: { | ||
| 28 | - fetchData () { | ||
| 29 | - if (this.$route.meta.isIndex) { | ||
| 30 | - this.isIndex = true | ||
| 31 | - } else { | ||
| 32 | - this.isIndex = false | ||
| 33 | - } | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | -} | ||
| 37 | -</script> | ||
| 38 | - | ||
| 39 | -<style lang="less"> | ||
| 40 | - html, body { | ||
| 41 | - font-family: '微软雅黑', Microsoft YaHei; | ||
| 42 | - height: 100%; | ||
| 43 | - width: 100%; | ||
| 44 | - overflow-x: hidden; | ||
| 45 | - background-color: #F0EFF5; | ||
| 46 | - #login { | ||
| 47 | - } | ||
| 48 | - } | ||
| 49 | -</style> |
src/multiPages/C/http.js
deleted
100644 → 0
| 1 | -/* jshint esversion: 6 */ | ||
| 2 | -import axios from 'axios' | ||
| 3 | -import router from './router' | ||
| 4 | - | ||
| 5 | -// 请求拦截器 | ||
| 6 | -axios.interceptors.request.use( | ||
| 7 | - config => { | ||
| 8 | - // 发送请求前 | ||
| 9 | - return config | ||
| 10 | - }, | ||
| 11 | - error => { | ||
| 12 | - // 请求错误处理 | ||
| 13 | - return Promise.reject(error) | ||
| 14 | - }) | ||
| 15 | - | ||
| 16 | -// 响应拦截器 | ||
| 17 | -axios.interceptors.response.use( | ||
| 18 | - response => { | ||
| 19 | - return response | ||
| 20 | - }, | ||
| 21 | - error => { | ||
| 22 | - if (error.response) { | ||
| 23 | - switch (error.response.status) { | ||
| 24 | - case 401: | ||
| 25 | - router.replace({ | ||
| 26 | - path: '/' | ||
| 27 | - }) | ||
| 28 | - break | ||
| 29 | - case 404: | ||
| 30 | - router.replace({ | ||
| 31 | - path: '/' | ||
| 32 | - }) | ||
| 33 | - break | ||
| 34 | - } | ||
| 35 | - } | ||
| 36 | - return Promise.reject(error.response.data) | ||
| 37 | - }) | ||
| 38 | - | ||
| 39 | -export default axios |
src/multiPages/C/route.js
deleted
100644 → 0
src/multiPages/C/router.js
deleted
100644 → 0
| 1 | -/* jshint esversion: 6 */ | ||
| 2 | -import Vue from 'vue' | ||
| 3 | -import VueRouter from 'vue-router' | ||
| 4 | -import ConfigRouter from './route.js' | ||
| 5 | -import store from './vuex/store' | ||
| 6 | - | ||
| 7 | -Vue.use(VueRouter) | ||
| 8 | - | ||
| 9 | -const router = new VueRouter({ | ||
| 10 | - history: false, | ||
| 11 | - hashbang: true, | ||
| 12 | - base: __dirname, | ||
| 13 | - routes: ConfigRouter | ||
| 14 | -}) | ||
| 15 | - | ||
| 16 | -router.beforeEach((to, from, next) => { | ||
| 17 | - store.commit('updateLoadingStatus', true) | ||
| 18 | - next() | ||
| 19 | -}) | ||
| 20 | - | ||
| 21 | -router.afterEach((to, from, next) => { | ||
| 22 | - store.commit('updateLoadingStatus', false) | ||
| 23 | -}) | ||
| 24 | - | ||
| 25 | -export default router |
| 1 | -function initFontSize (baseFontSize, baseWidth) { | ||
| 2 | - let clientWidth = document.documentElement.clientWidth || window.innerWidth() | ||
| 3 | - let size = Math.floor(clientWidth / baseWidth * baseFontSize) | ||
| 4 | - document.querySelector('html').style.fontSize = size + 'px' | ||
| 5 | -} | ||
| 6 | -initFontSize(100, 1080) | ||
| 7 | -window.onresize = function () { | ||
| 8 | - initFontSize(100, 1080) | ||
| 9 | -} |
src/multiPages/C/views/login.vue
deleted
100644 → 0
| 1 | -<template> | ||
| 2 | - <div> | ||
| 3 | - <!-- <van-password-input | ||
| 4 | - :value="value" | ||
| 5 | - info="密码为6位数字" | ||
| 6 | - @focus="keyboard = 'custom'" | ||
| 7 | - /> --> | ||
| 8 | - <van-field v-model="value" :maxlength="10" @click.native="keyboard = 'custom'" @blur="onBlur" readonly placeholder="请输入用户名" /> | ||
| 9 | - <!-- <van-number-keyboard | ||
| 10 | - :show="showKeyboard" | ||
| 11 | - @input="onInput" | ||
| 12 | - @delete="onDelete" | ||
| 13 | - @blur="showKeyboard = false" | ||
| 14 | - /> --> | ||
| 15 | - <van-number-keyboard | ||
| 16 | - :show="keyboard === 'custom'" | ||
| 17 | - close-button-text="完成" | ||
| 18 | - theme="custom" | ||
| 19 | - extra-key="." | ||
| 20 | - @blur="keyboard = ''" | ||
| 21 | - @input="onInput" | ||
| 22 | - @delete="onDelete" | ||
| 23 | - @close="onClose" | ||
| 24 | - /> | ||
| 25 | - </div> | ||
| 26 | -</template> | ||
| 27 | - | ||
| 28 | -<script> | ||
| 29 | -export default { | ||
| 30 | - data () { | ||
| 31 | - return { | ||
| 32 | - value: '', | ||
| 33 | - showKeyboard: true, | ||
| 34 | - keyboard: 'default' | ||
| 35 | - } | ||
| 36 | - }, | ||
| 37 | - methods: { | ||
| 38 | - onInput (key) { | ||
| 39 | - this.value = (this.value + key).slice(0, 5) | ||
| 40 | - }, | ||
| 41 | - onDelete () { | ||
| 42 | - this.value = this.value.slice(0, this.value.length - 1) | ||
| 43 | - }, | ||
| 44 | - onBlur () { | ||
| 45 | - // console.warn(this.value); | ||
| 46 | - }, | ||
| 47 | - onClose () { | ||
| 48 | - this.keyboard = false | ||
| 49 | - } | ||
| 50 | - } | ||
| 51 | -} | ||
| 52 | -</script> | ||
| 53 | - | ||
| 54 | -<style lang="less" scoped> | ||
| 55 | -.login { | ||
| 56 | - position: absolute; | ||
| 57 | - top: 25%; | ||
| 58 | - left: 50%; | ||
| 59 | - transform: translateX(-50%); | ||
| 60 | - padding: 1.8rem 2.5rem; | ||
| 61 | - width: 15rem; | ||
| 62 | - button { | ||
| 63 | - margin-top: 1.2rem; | ||
| 64 | - position: absolute; | ||
| 65 | - right: 2.5rem; | ||
| 66 | - } | ||
| 67 | - input { | ||
| 68 | - display: block; | ||
| 69 | - width: 95%; | ||
| 70 | - padding: 0.8rem 0.4rem; | ||
| 71 | - background: #fff; | ||
| 72 | - border: 1px solid #d6d7dc; | ||
| 73 | - font-size: 0.95rem; | ||
| 74 | - } | ||
| 75 | -} | ||
| 76 | -</style> |
src/multiPages/C/vuex/actions.js
deleted
100644 → 0
src/multiPages/C/vuex/getters.js
deleted
100644 → 0
src/multiPages/C/vuex/store.js
deleted
100644 → 0
| 1 | -import Vue from 'vue' | ||
| 2 | -import Vuex from 'vuex' | ||
| 3 | -import * as actions from './actions' | ||
| 4 | -import * as getters from './getters' | ||
| 5 | - | ||
| 6 | -Vue.use(Vuex) | ||
| 7 | - | ||
| 8 | -// 应用初始状态 | ||
| 9 | -const state = { | ||
| 10 | - isLoading: false, | ||
| 11 | - title: '登录', | ||
| 12 | - form: '', | ||
| 13 | - direction: 'forward' | ||
| 14 | -} | ||
| 15 | - | ||
| 16 | -// 定义所需的 mutations | ||
| 17 | -const mutations = { | ||
| 18 | - updateLoadingStatus (state, status) { | ||
| 19 | - state.isLoading = status | ||
| 20 | - }, | ||
| 21 | - changeTitle (state, title) { | ||
| 22 | - state.title = title | ||
| 23 | - }, | ||
| 24 | - savedForm (state, form) { | ||
| 25 | - state.form = form | ||
| 26 | - }, | ||
| 27 | - UPDATE_DIRECTION (state, direction) { | ||
| 28 | - state.direction = direction | ||
| 29 | - } | ||
| 30 | -} | ||
| 31 | - | ||
| 32 | -// 创建 store 实例 | ||
| 33 | -export default new Vuex.Store({ | ||
| 34 | - actions, | ||
| 35 | - getters, | ||
| 36 | - state, | ||
| 37 | - mutations | ||
| 38 | -}) |
| ... | @@ -113,7 +113,6 @@ export default { | ... | @@ -113,7 +113,6 @@ export default { |
| 113 | }, 1000) | 113 | }, 1000) |
| 114 | }, | 114 | }, |
| 115 | onClick () { | 115 | onClick () { |
| 116 | - // this.show = true; | ||
| 117 | if (_.random(1, true) > 0.5) { | 116 | if (_.random(1, true) > 0.5) { |
| 118 | const images = [ | 117 | const images = [ |
| 119 | 'https://img.yzcdn.cn/public_files/2017/09/05/3bd347e44233a868c99cf0fe560232be.jpg' | 118 | 'https://img.yzcdn.cn/public_files/2017/09/05/3bd347e44233a868c99cf0fe560232be.jpg' | ... | ... |
| ... | @@ -41,17 +41,20 @@ const cdn = { | ... | @@ -41,17 +41,20 @@ const cdn = { |
| 41 | // 生产环境 | 41 | // 生产环境 |
| 42 | build: { | 42 | build: { |
| 43 | css: [ | 43 | css: [ |
| 44 | - 'https://cdn.jsdelivr.net/npm/vant@1.5/lib/index.css' | 44 | + // 'https://cdn.jsdelivr.net/npm/vant@1.5/lib/index.css' |
| 45 | + 'http://boh.onwall.cn/vant@1.5/lib/index.css' | ||
| 45 | ], | 46 | ], |
| 46 | js: [ | 47 | js: [ |
| 47 | 'https://cdn.bootcss.com/vue/2.5.21/vue.min.js', | 48 | 'https://cdn.bootcss.com/vue/2.5.21/vue.min.js', |
| 48 | 'https://cdn.bootcss.com/vue-router/3.0.2/vue-router.min.js', | 49 | 'https://cdn.bootcss.com/vue-router/3.0.2/vue-router.min.js', |
| 49 | 'https://cdn.bootcss.com/vuex/3.0.1/vuex.min.js', | 50 | 'https://cdn.bootcss.com/vuex/3.0.1/vuex.min.js', |
| 50 | 'https://cdn.bootcss.com/axios/0.18.0/axios.min.js', | 51 | 'https://cdn.bootcss.com/axios/0.18.0/axios.min.js', |
| 51 | - 'https://cdn.jsdelivr.net/npm/vant@1.5/lib/vant.min.js', | 52 | + // 'https://cdn.jsdelivr.net/npm/vant@1.5/lib/vant.min.js', |
| 53 | + 'http://boh.onwall.cn/vant@1.5/lib/vant.min.js', | ||
| 52 | 'https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js', | 54 | 'https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js', |
| 53 | 'https://cdn.bootcss.com/moment.js/2.23.0/moment.min.js', | 55 | 'https://cdn.bootcss.com/moment.js/2.23.0/moment.min.js', |
| 54 | - 'https://cdn.bootcss.com/lodash.js/4.17.11/lodash.min.js', | 56 | + 'https://cdn.bootcss.com/lodash.js/4.17.11/lodash.core.min.js', |
| 57 | + // 'https://cdn.bootcss.com/lodash.js/4.17.11/lodash.min.js', | ||
| 55 | 'https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js' | 58 | 'https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js' |
| 56 | ] | 59 | ] |
| 57 | } | 60 | } |
| ... | @@ -211,33 +214,6 @@ module.exports = { | ... | @@ -211,33 +214,6 @@ module.exports = { |
| 211 | args[0].dnsPrefetch = dnsPrefetch; | 214 | args[0].dnsPrefetch = dnsPrefetch; |
| 212 | return args; | 215 | return args; |
| 213 | }) | 216 | }) |
| 214 | - .end() | ||
| 215 | - .plugin('html-A') | ||
| 216 | - .tap(args => { | ||
| 217 | - if (process.env.NODE_ENV === 'production') { | ||
| 218 | - } | ||
| 219 | - args[0].cdn = cdn.build; | ||
| 220 | - args[0].dnsPrefetch = dnsPrefetch; | ||
| 221 | - return args; | ||
| 222 | - }) | ||
| 223 | - .end() | ||
| 224 | - .plugin('html-B') | ||
| 225 | - .tap(args => { | ||
| 226 | - if (process.env.NODE_ENV === 'production') { | ||
| 227 | - } | ||
| 228 | - args[0].cdn = cdn.build; | ||
| 229 | - args[0].dnsPrefetch = dnsPrefetch; | ||
| 230 | - return args; | ||
| 231 | - }) | ||
| 232 | - .end() | ||
| 233 | - .plugin('html-C') | ||
| 234 | - .tap(args => { | ||
| 235 | - if (process.env.NODE_ENV === 'production') { | ||
| 236 | - } | ||
| 237 | - args[0].cdn = cdn.build; | ||
| 238 | - args[0].dnsPrefetch = dnsPrefetch; | ||
| 239 | - return args; | ||
| 240 | - }) | ||
| 241 | .end(); | 217 | .end(); |
| 242 | }, | 218 | }, |
| 243 | // css相关配置 | 219 | // css相关配置 | ... | ... |
-
Please register or login to post a comment