mirror of
https://github.com/sunniejs/vue-h5-template.git
synced 2025-09-19 14:00:01 +08:00
解决bable cannot call a class as a func
This commit is contained in:
parent
ca44e7447a
commit
679cc07160
12
.babelrc
12
.babelrc
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"presets": [
|
|
||||||
[ "@babel/preset-env", {
|
|
||||||
"targets": {
|
|
||||||
"browsers": [ "last 1 version", "ie >= 11" ]
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"@babel/plugin-transform-runtime"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,4 +1,3 @@
|
|||||||
process.env.VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [['@vue/app', { useBuiltIns: 'entry' }]],
|
presets: [['@vue/app', { useBuiltIns: 'entry' }]],
|
||||||
plugins: [
|
plugins: [
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
||||||
<% for (var i in
|
|
||||||
htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
|
|
||||||
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
|
|
||||||
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
|
|
||||||
<% } %>
|
|
||||||
<title><%= webpackConfig.name %></title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>
|
|
||||||
<strong>We're sorry but <%= webpackConfig.name %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
||||||
</noscript>
|
|
||||||
<div id="app"></div>
|
|
||||||
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
|
|
||||||
<% for (var i in
|
|
||||||
htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
|
|
||||||
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
|
|
||||||
<% } %>
|
|
||||||
<!-- built files will be auto injected -->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -5,6 +5,11 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
|
<% for (var i in
|
||||||
|
htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %>
|
||||||
|
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="preload" as="style" />
|
||||||
|
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet" />
|
||||||
|
<% } %>
|
||||||
<title><%= webpackConfig.name %></title>
|
<title><%= webpackConfig.name %></title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -13,6 +18,10 @@
|
|||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
|
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
|
||||||
|
<% for (var i in
|
||||||
|
htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
|
||||||
|
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
|
||||||
|
<% } %>
|
||||||
<!-- built files will be auto injected -->
|
<!-- built files will be auto injected -->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import '@babel/polyfill'
|
|
||||||
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
|
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
|
||||||
import '@/assets/css/index.scss' // global css
|
import '@/assets/css/index.scss' // global css
|
||||||
// 移动端适配
|
// 移动端适配
|
||||||
@ -11,6 +10,7 @@ import '@/filters' // filters
|
|||||||
import '@/utils/directives' // directives
|
import '@/utils/directives' // directives
|
||||||
import '@/permission' // permission control
|
import '@/permission' // permission control
|
||||||
import wechatAuth from './plugins/wechatAuth' // 微信登录插件
|
import wechatAuth from './plugins/wechatAuth' // 微信登录插件
|
||||||
|
|
||||||
Vue.use(wechatAuth, {
|
Vue.use(wechatAuth, {
|
||||||
appid: process.env.VUE_APP_WECHAT_APPID
|
appid: process.env.VUE_APP_WECHAT_APPID
|
||||||
})
|
})
|
||||||
|
@ -4,14 +4,6 @@ import getPageTitle from '@/utils/get-page-title'
|
|||||||
import wechatAuth from './plugins/wechatAuth' // 微信登录插件
|
import wechatAuth from './plugins/wechatAuth' // 微信登录插件
|
||||||
const qs = require('qs')
|
const qs = require('qs')
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
// next()
|
|
||||||
// store.dispatch('user/fedLogOut').then(() => {
|
|
||||||
// // location.reload()
|
|
||||||
// })
|
|
||||||
// store.dispatch('user/setLoginStatus', 0)
|
|
||||||
// alert(store.getters.loginStatus)
|
|
||||||
// return false
|
|
||||||
// alert(store.getters.loginStatus)
|
|
||||||
const loginStatus = Number(store.getters.loginStatus)
|
const loginStatus = Number(store.getters.loginStatus)
|
||||||
document.title = getPageTitle(to.meta.title)
|
document.title = getPageTitle(to.meta.title)
|
||||||
if (loginStatus === 0) {
|
if (loginStatus === 0) {
|
||||||
|
@ -101,8 +101,8 @@ class VueWechatAuthPlugin {
|
|||||||
|
|
||||||
const vueWechatAuthPlugin = new VueWechatAuthPlugin()
|
const vueWechatAuthPlugin = new VueWechatAuthPlugin()
|
||||||
|
|
||||||
if (typeof window !== 'undefined' && window.Vue) {
|
// if (typeof window !== 'undefined' && window.Vue) {
|
||||||
window.Vue.use(VueWechatAuthPlugin)
|
// window.Vue.use(VueWechatAuthPlugin)
|
||||||
}
|
// }
|
||||||
|
|
||||||
export default vueWechatAuthPlugin
|
export default vueWechatAuthPlugin
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const defaultSettings = require('./src/config/index.js')
|
||||||
function resolve(dir) {
|
function resolve(dir) {
|
||||||
return path.join(__dirname, dir)
|
return path.join(__dirname, dir)
|
||||||
}
|
}
|
||||||
@ -24,7 +25,7 @@ const cdn = {
|
|||||||
build: {
|
build: {
|
||||||
css: ['https://cdn.jsdelivr.net/npm/vant@beta/lib/index.css'],
|
css: ['https://cdn.jsdelivr.net/npm/vant@beta/lib/index.css'],
|
||||||
js: [
|
js: [
|
||||||
// 'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.4.4/polyfill.min.js',
|
'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.4.4/polyfill.min.js',
|
||||||
'https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js',
|
'https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js',
|
||||||
'https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.6/vue-router.min.js',
|
'https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.0.6/vue-router.min.js',
|
||||||
'https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js',
|
'https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.min.js',
|
||||||
@ -37,6 +38,7 @@ const cdn = {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
publicPath: process.env.NODE_ENV === 'production' ? '/antpublic/' : '/',
|
publicPath: process.env.NODE_ENV === 'production' ? '/antpublic/' : '/',
|
||||||
outputDir: 'dist',
|
outputDir: 'dist',
|
||||||
|
// outputDir: '../../../phpStudy/PHPTutorial/WWW/antpublic',
|
||||||
assetsDir: 'static',
|
assetsDir: 'static',
|
||||||
lintOnSave: process.env.NODE_ENV === 'development',
|
lintOnSave: process.env.NODE_ENV === 'development',
|
||||||
productionSourceMap: false,
|
productionSourceMap: false,
|
||||||
@ -49,18 +51,23 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
disableHostCheck: true
|
disableHostCheck: true
|
||||||
},
|
},
|
||||||
// configureWebpack: config => {
|
configureWebpack: config => {
|
||||||
// // 为生产环境修改配置...
|
// 为生产环境修改配置...
|
||||||
// if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
// // externals里的模块不打包
|
// externals里的模块不打包
|
||||||
// Object.assign(config, {
|
Object.assign(config, {
|
||||||
// externals: externals
|
name: defaultSettings.title,
|
||||||
// })
|
// entry: ['@babel/polyfill', './src/main.js'],
|
||||||
// }
|
externals: externals,
|
||||||
// // 为开发环境修改配置...
|
optimization: {
|
||||||
// if (process.env.NODE_ENV === 'development') {
|
minimize: false
|
||||||
// }
|
}
|
||||||
// },
|
})
|
||||||
|
}
|
||||||
|
// 为开发环境修改配置...
|
||||||
|
if (process.env.NODE_ENV === 'development') {
|
||||||
|
}
|
||||||
|
},
|
||||||
chainWebpack(config) {
|
chainWebpack(config) {
|
||||||
config.plugins.delete('preload') // TODO: need test
|
config.plugins.delete('preload') // TODO: need test
|
||||||
config.plugins.delete('prefetch') // TODO: need test
|
config.plugins.delete('prefetch') // TODO: need test
|
||||||
@ -74,16 +81,15 @@ module.exports = {
|
|||||||
/**
|
/**
|
||||||
* 添加CDN参数到htmlWebpackPlugin配置中, 详见public/index.html 修改
|
* 添加CDN参数到htmlWebpackPlugin配置中, 详见public/index.html 修改
|
||||||
*/
|
*/
|
||||||
// config.plugin('html').tap(args => {
|
config.plugin('html').tap(args => {
|
||||||
// if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
// args[0].cdn = cdn.build
|
args[0].cdn = cdn.build
|
||||||
// }
|
}
|
||||||
// if (process.env.NODE_ENV === 'development') {
|
if (process.env.NODE_ENV === 'development') {
|
||||||
// args[0].cdn = cdn.dev
|
args[0].cdn = cdn.dev
|
||||||
// }
|
}
|
||||||
// console.log(args)
|
return args
|
||||||
// return args
|
})
|
||||||
// })
|
|
||||||
|
|
||||||
// set preserveWhitespace
|
// set preserveWhitespace
|
||||||
config.module
|
config.module
|
||||||
|
Loading…
x
Reference in New Issue
Block a user