Upgrade to Vue Cli 4.X
This commit is contained in:
parent
de55fe7a1c
commit
3260eac063
29
.babelrc
29
.babelrc
|
@ -1,29 +0,0 @@
|
||||||
{
|
|
||||||
"presets": [
|
|
||||||
[
|
|
||||||
"env",
|
|
||||||
{
|
|
||||||
"modules": false,
|
|
||||||
"targets": {
|
|
||||||
"browsers": [
|
|
||||||
"> 1%",
|
|
||||||
"last 2 versions",
|
|
||||||
"not ie <= 8"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"stage-2"
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"transform-vue-jsx",
|
|
||||||
"transform-runtime",
|
|
||||||
[
|
|
||||||
"component",
|
|
||||||
{
|
|
||||||
"libraryName": "element-ui",
|
|
||||||
"styleLibraryName": "theme-chalk"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
trim_trailing_whitespace = true
|
|
|
@ -1,9 +1,17 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
node_modules/
|
node_modules
|
||||||
/dist/
|
/dist
|
||||||
|
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
yarn-debug.log*
|
yarn-debug.log*
|
||||||
yarn-error.log*
|
yarn-error.log*
|
||||||
|
pnpm-debug.log*
|
||||||
|
|
||||||
# Editor directories and files
|
# Editor directories and files
|
||||||
.idea
|
.idea
|
||||||
|
@ -12,3 +20,4 @@ yarn-error.log*
|
||||||
*.ntvs*
|
*.ntvs*
|
||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
|
*.sw?
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
"plugins": {
|
|
||||||
"postcss-import": {},
|
|
||||||
"postcss-url": {},
|
|
||||||
// to edit target browsers: use "browserslist" field in package.json
|
|
||||||
"autoprefixer": {}
|
|
||||||
}
|
|
||||||
}
|
|
165
LICENSE
165
LICENSE
|
@ -1,165 +0,0 @@
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
|
|
||||||
This version of the GNU Lesser General Public License incorporates
|
|
||||||
the terms and conditions of version 3 of the GNU General Public
|
|
||||||
License, supplemented by the additional permissions listed below.
|
|
||||||
|
|
||||||
0. Additional Definitions.
|
|
||||||
|
|
||||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
||||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
||||||
General Public License.
|
|
||||||
|
|
||||||
"The Library" refers to a covered work governed by this License,
|
|
||||||
other than an Application or a Combined Work as defined below.
|
|
||||||
|
|
||||||
An "Application" is any work that makes use of an interface provided
|
|
||||||
by the Library, but which is not otherwise based on the Library.
|
|
||||||
Defining a subclass of a class defined by the Library is deemed a mode
|
|
||||||
of using an interface provided by the Library.
|
|
||||||
|
|
||||||
A "Combined Work" is a work produced by combining or linking an
|
|
||||||
Application with the Library. The particular version of the Library
|
|
||||||
with which the Combined Work was made is also called the "Linked
|
|
||||||
Version".
|
|
||||||
|
|
||||||
The "Minimal Corresponding Source" for a Combined Work means the
|
|
||||||
Corresponding Source for the Combined Work, excluding any source code
|
|
||||||
for portions of the Combined Work that, considered in isolation, are
|
|
||||||
based on the Application, and not on the Linked Version.
|
|
||||||
|
|
||||||
The "Corresponding Application Code" for a Combined Work means the
|
|
||||||
object code and/or source code for the Application, including any data
|
|
||||||
and utility programs needed for reproducing the Combined Work from the
|
|
||||||
Application, but excluding the System Libraries of the Combined Work.
|
|
||||||
|
|
||||||
1. Exception to Section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
You may convey a covered work under sections 3 and 4 of this License
|
|
||||||
without being bound by section 3 of the GNU GPL.
|
|
||||||
|
|
||||||
2. Conveying Modified Versions.
|
|
||||||
|
|
||||||
If you modify a copy of the Library, and, in your modifications, a
|
|
||||||
facility refers to a function or data to be supplied by an Application
|
|
||||||
that uses the facility (other than as an argument passed when the
|
|
||||||
facility is invoked), then you may convey a copy of the modified
|
|
||||||
version:
|
|
||||||
|
|
||||||
a) under this License, provided that you make a good faith effort to
|
|
||||||
ensure that, in the event an Application does not supply the
|
|
||||||
function or data, the facility still operates, and performs
|
|
||||||
whatever part of its purpose remains meaningful, or
|
|
||||||
|
|
||||||
b) under the GNU GPL, with none of the additional permissions of
|
|
||||||
this License applicable to that copy.
|
|
||||||
|
|
||||||
3. Object Code Incorporating Material from Library Header Files.
|
|
||||||
|
|
||||||
The object code form of an Application may incorporate material from
|
|
||||||
a header file that is part of the Library. You may convey such object
|
|
||||||
code under terms of your choice, provided that, if the incorporated
|
|
||||||
material is not limited to numerical parameters, data structure
|
|
||||||
layouts and accessors, or small macros, inline functions and templates
|
|
||||||
(ten or fewer lines in length), you do both of the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the object code that the
|
|
||||||
Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
4. Combined Works.
|
|
||||||
|
|
||||||
You may convey a Combined Work under terms of your choice that,
|
|
||||||
taken together, effectively do not restrict modification of the
|
|
||||||
portions of the Library contained in the Combined Work and reverse
|
|
||||||
engineering for debugging such modifications, if you also do each of
|
|
||||||
the following:
|
|
||||||
|
|
||||||
a) Give prominent notice with each copy of the Combined Work that
|
|
||||||
the Library is used in it and that the Library and its use are
|
|
||||||
covered by this License.
|
|
||||||
|
|
||||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
||||||
document.
|
|
||||||
|
|
||||||
c) For a Combined Work that displays copyright notices during
|
|
||||||
execution, include the copyright notice for the Library among
|
|
||||||
these notices, as well as a reference directing the user to the
|
|
||||||
copies of the GNU GPL and this license document.
|
|
||||||
|
|
||||||
d) Do one of the following:
|
|
||||||
|
|
||||||
0) Convey the Minimal Corresponding Source under the terms of this
|
|
||||||
License, and the Corresponding Application Code in a form
|
|
||||||
suitable for, and under terms that permit, the user to
|
|
||||||
recombine or relink the Application with a modified version of
|
|
||||||
the Linked Version to produce a modified Combined Work, in the
|
|
||||||
manner specified by section 6 of the GNU GPL for conveying
|
|
||||||
Corresponding Source.
|
|
||||||
|
|
||||||
1) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (a) uses at run time
|
|
||||||
a copy of the Library already present on the user's computer
|
|
||||||
system, and (b) will operate properly with a modified version
|
|
||||||
of the Library that is interface-compatible with the Linked
|
|
||||||
Version.
|
|
||||||
|
|
||||||
e) Provide Installation Information, but only if you would otherwise
|
|
||||||
be required to provide such information under section 6 of the
|
|
||||||
GNU GPL, and only to the extent that such information is
|
|
||||||
necessary to install and execute a modified version of the
|
|
||||||
Combined Work produced by recombining or relinking the
|
|
||||||
Application with a modified version of the Linked Version. (If
|
|
||||||
you use option 4d0, the Installation Information must accompany
|
|
||||||
the Minimal Corresponding Source and Corresponding Application
|
|
||||||
Code. If you use option 4d1, you must provide the Installation
|
|
||||||
Information in the manner specified by section 6 of the GNU GPL
|
|
||||||
for conveying Corresponding Source.)
|
|
||||||
|
|
||||||
5. Combined Libraries.
|
|
||||||
|
|
||||||
You may place library facilities that are a work based on the
|
|
||||||
Library side by side in a single library together with other library
|
|
||||||
facilities that are not Applications and are not covered by this
|
|
||||||
License, and convey such a combined library under terms of your
|
|
||||||
choice, if you do both of the following:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work based
|
|
||||||
on the Library, uncombined with any other library facilities,
|
|
||||||
conveyed under the terms of this License.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library that part of it
|
|
||||||
is a work based on the Library, and explaining where to find the
|
|
||||||
accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
6. Revised Versions of the GNU Lesser General Public License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions
|
|
||||||
of the GNU Lesser General Public License from time to time. Such new
|
|
||||||
versions will be similar in spirit to the present version, but may
|
|
||||||
differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Library as you received it specifies that a certain numbered version
|
|
||||||
of the GNU Lesser General Public License "or any later version"
|
|
||||||
applies to it, you have the option of following the terms and
|
|
||||||
conditions either of that published version or of any later version
|
|
||||||
published by the Free Software Foundation. If the Library as you
|
|
||||||
received it does not specify a version number of the GNU Lesser
|
|
||||||
General Public License, you may choose any version of the GNU Lesser
|
|
||||||
General Public License ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Library as you received it specifies that a proxy can decide
|
|
||||||
whether future versions of the GNU Lesser General Public License shall
|
|
||||||
apply, that proxy's public statement of acceptance of any version is
|
|
||||||
permanent authorization for you to choose that version for the
|
|
||||||
Library.
|
|
35
README.md
35
README.md
|
@ -1,21 +1,24 @@
|
||||||
# vkconfig
|
# vkconfig
|
||||||
|
|
||||||
> A Vue.js project
|
## Project setup
|
||||||
|
```
|
||||||
## Build Setup
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
# install dependencies
|
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
# serve with hot reload at localhost:8080
|
|
||||||
npm run dev
|
|
||||||
|
|
||||||
# build for production with minification
|
|
||||||
npm run build
|
|
||||||
|
|
||||||
# build for production and view the bundle analyzer report
|
|
||||||
npm run build --report
|
|
||||||
```
|
```
|
||||||
|
|
||||||
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
|
### Compiles and hot-reloads for development
|
||||||
|
```
|
||||||
|
npm run serve
|
||||||
|
```
|
||||||
|
|
||||||
|
### Compiles and minifies for production
|
||||||
|
```
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
### Lints and fixes files
|
||||||
|
```
|
||||||
|
npm run lint
|
||||||
|
```
|
||||||
|
|
||||||
|
### Customize configuration
|
||||||
|
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
module.exports = {
|
||||||
|
"presets": [
|
||||||
|
"@vue/cli-plugin-babel/preset"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"component",
|
||||||
|
{
|
||||||
|
"libraryName": "element-ui",
|
||||||
|
"styleLibraryName": "theme-chalk"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,41 +0,0 @@
|
||||||
'use strict'
|
|
||||||
require('./check-versions')()
|
|
||||||
|
|
||||||
process.env.NODE_ENV = 'production'
|
|
||||||
|
|
||||||
const ora = require('ora')
|
|
||||||
const rm = require('rimraf')
|
|
||||||
const path = require('path')
|
|
||||||
const chalk = require('chalk')
|
|
||||||
const webpack = require('webpack')
|
|
||||||
const config = require('../config')
|
|
||||||
const webpackConfig = require('./webpack.prod.conf')
|
|
||||||
|
|
||||||
const spinner = ora('building for production...')
|
|
||||||
spinner.start()
|
|
||||||
|
|
||||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
|
||||||
if (err) throw err
|
|
||||||
webpack(webpackConfig, (err, stats) => {
|
|
||||||
spinner.stop()
|
|
||||||
if (err) throw err
|
|
||||||
process.stdout.write(stats.toString({
|
|
||||||
colors: true,
|
|
||||||
modules: false,
|
|
||||||
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
|
||||||
chunks: false,
|
|
||||||
chunkModules: false
|
|
||||||
}) + '\n\n')
|
|
||||||
|
|
||||||
if (stats.hasErrors()) {
|
|
||||||
console.log(chalk.red(' Build failed with errors.\n'))
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(chalk.cyan(' Build complete.\n'))
|
|
||||||
console.log(chalk.yellow(
|
|
||||||
' Tip: built files are meant to be served over an HTTP server.\n' +
|
|
||||||
' Opening index.html over file:// won\'t work.\n'
|
|
||||||
))
|
|
||||||
})
|
|
||||||
})
|
|
|
@ -1,54 +0,0 @@
|
||||||
'use strict'
|
|
||||||
const chalk = require('chalk')
|
|
||||||
const semver = require('semver')
|
|
||||||
const packageConfig = require('../package.json')
|
|
||||||
const shell = require('shelljs')
|
|
||||||
|
|
||||||
function exec (cmd) {
|
|
||||||
return require('child_process').execSync(cmd).toString().trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
const versionRequirements = [
|
|
||||||
{
|
|
||||||
name: 'node',
|
|
||||||
currentVersion: semver.clean(process.version),
|
|
||||||
versionRequirement: packageConfig.engines.node
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
if (shell.which('npm')) {
|
|
||||||
versionRequirements.push({
|
|
||||||
name: 'npm',
|
|
||||||
currentVersion: exec('npm --version'),
|
|
||||||
versionRequirement: packageConfig.engines.npm
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function () {
|
|
||||||
const warnings = []
|
|
||||||
|
|
||||||
for (let i = 0; i < versionRequirements.length; i++) {
|
|
||||||
const mod = versionRequirements[i]
|
|
||||||
|
|
||||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
|
||||||
warnings.push(mod.name + ': ' +
|
|
||||||
chalk.red(mod.currentVersion) + ' should be ' +
|
|
||||||
chalk.green(mod.versionRequirement)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (warnings.length) {
|
|
||||||
console.log('')
|
|
||||||
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
|
||||||
console.log()
|
|
||||||
|
|
||||||
for (let i = 0; i < warnings.length; i++) {
|
|
||||||
const warning = warnings[i]
|
|
||||||
console.log(' ' + warning)
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log()
|
|
||||||
process.exit(1)
|
|
||||||
}
|
|
||||||
}
|
|
BIN
build/logo.png
BIN
build/logo.png
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
106
build/utils.js
106
build/utils.js
|
@ -1,106 +0,0 @@
|
||||||
'use strict'
|
|
||||||
const path = require('path')
|
|
||||||
const config = require('../config')
|
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
|
||||||
const packageConfig = require('../package.json')
|
|
||||||
|
|
||||||
exports.assetsPath = function (_path) {
|
|
||||||
const assetsSubDirectory = process.env.NODE_ENV === 'production'
|
|
||||||
? config.build.assetsSubDirectory
|
|
||||||
: config.dev.assetsSubDirectory
|
|
||||||
|
|
||||||
return path.posix.join(assetsSubDirectory, _path)
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.cssLoaders = function (options) {
|
|
||||||
options = options || {}
|
|
||||||
|
|
||||||
const cssLoader = {
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: options.sourceMap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const postcssLoader = {
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: options.sourceMap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const px2remLoader = {
|
|
||||||
loader: 'px2rem-loader',
|
|
||||||
options: {
|
|
||||||
remUnit: 75 // (这里是指设计稿的宽度为 750 / 10)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// generate loader string to be used with extract text plugin
|
|
||||||
function generateLoaders (loader, loaderOptions) {
|
|
||||||
const loaders = options.usePostCSS ? [cssLoader, postcssLoader, px2remLoader] : [cssLoader]
|
|
||||||
|
|
||||||
if (loader) {
|
|
||||||
loaders.push({
|
|
||||||
loader: loader + '-loader',
|
|
||||||
options: Object.assign({}, loaderOptions, {
|
|
||||||
sourceMap: options.sourceMap
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Extract CSS when that option is specified
|
|
||||||
// (which is the case during production build)
|
|
||||||
if (options.extract) {
|
|
||||||
return ExtractTextPlugin.extract({
|
|
||||||
use: loaders,
|
|
||||||
fallback: 'vue-style-loader'
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
return ['vue-style-loader'].concat(loaders)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
|
||||||
return {
|
|
||||||
css: generateLoaders(),
|
|
||||||
postcss: generateLoaders(),
|
|
||||||
less: generateLoaders('less'),
|
|
||||||
sass: generateLoaders('sass', { indentedSyntax: true }),
|
|
||||||
scss: generateLoaders('sass'),
|
|
||||||
stylus: generateLoaders('stylus'),
|
|
||||||
styl: generateLoaders('stylus')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generate loaders for standalone style files (outside of .vue)
|
|
||||||
exports.styleLoaders = function (options) {
|
|
||||||
const output = []
|
|
||||||
const loaders = exports.cssLoaders(options)
|
|
||||||
|
|
||||||
for (const extension in loaders) {
|
|
||||||
const loader = loaders[extension]
|
|
||||||
output.push({
|
|
||||||
test: new RegExp('\\.' + extension + '$'),
|
|
||||||
use: loader
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return output
|
|
||||||
}
|
|
||||||
|
|
||||||
exports.createNotifierCallback = () => {
|
|
||||||
const notifier = require('node-notifier')
|
|
||||||
|
|
||||||
return (severity, errors) => {
|
|
||||||
if (severity !== 'error') return
|
|
||||||
|
|
||||||
const error = errors[0]
|
|
||||||
const filename = error.file && error.file.split('!').pop()
|
|
||||||
|
|
||||||
notifier.notify({
|
|
||||||
title: packageConfig.name,
|
|
||||||
message: severity + ': ' + error.name,
|
|
||||||
subtitle: filename || '',
|
|
||||||
icon: path.join(__dirname, 'logo.png')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
'use strict'
|
|
||||||
const utils = require('./utils')
|
|
||||||
const config = require('../config')
|
|
||||||
const isProduction = process.env.NODE_ENV === 'production'
|
|
||||||
const sourceMapEnabled = isProduction
|
|
||||||
? config.build.productionSourceMap
|
|
||||||
: config.dev.cssSourceMap
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
loaders: utils.cssLoaders({
|
|
||||||
sourceMap: sourceMapEnabled,
|
|
||||||
extract: isProduction
|
|
||||||
}),
|
|
||||||
cssSourceMap: sourceMapEnabled,
|
|
||||||
cacheBusting: config.dev.cacheBusting,
|
|
||||||
transformToRequire: {
|
|
||||||
video: ['src', 'poster'],
|
|
||||||
source: 'src',
|
|
||||||
img: 'src',
|
|
||||||
image: 'xlink:href'
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,74 +0,0 @@
|
||||||
'use strict'
|
|
||||||
const path = require('path')
|
|
||||||
const utils = require('./utils')
|
|
||||||
const config = require('../config')
|
|
||||||
const vueLoaderConfig = require('./vue-loader.conf')
|
|
||||||
|
|
||||||
function resolve (dir) {
|
|
||||||
return path.join(__dirname, '..', dir)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
context: path.resolve(__dirname, '../'),
|
|
||||||
entry: {
|
|
||||||
app: './src/main.js'
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
path: config.build.assetsRoot,
|
|
||||||
filename: '[name].js',
|
|
||||||
publicPath: process.env.NODE_ENV === 'production'
|
|
||||||
? config.build.assetsPublicPath
|
|
||||||
: config.dev.assetsPublicPath
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
extensions: ['.js', '.vue', '.json'],
|
|
||||||
alias: {
|
|
||||||
'vue$': 'vue/dist/vue.esm.js',
|
|
||||||
'@': resolve('src'),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.vue$/,
|
|
||||||
loader: 'vue-loader',
|
|
||||||
options: vueLoaderConfig
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.js$/,
|
|
||||||
loader: 'babel-loader',
|
|
||||||
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 10000,
|
|
||||||
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 10000,
|
|
||||||
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
node: {
|
|
||||||
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
|
||||||
// source contains it (although only uses it if it's native).
|
|
||||||
setImmediate: false,
|
|
||||||
// prevent webpack from injecting mocks to Node native modules
|
|
||||||
// that does not make sense for the client
|
|
||||||
dgram: 'empty',
|
|
||||||
fs: 'empty',
|
|
||||||
net: 'empty',
|
|
||||||
tls: 'empty',
|
|
||||||
child_process: 'empty'
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,104 +0,0 @@
|
||||||
'use strict'
|
|
||||||
const utils = require('./utils')
|
|
||||||
const webpack = require('webpack')
|
|
||||||
const config = require('../config')
|
|
||||||
const merge = require('webpack-merge')
|
|
||||||
const path = require('path')
|
|
||||||
const baseWebpackConfig = require('./webpack.base.conf')
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
||||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
|
||||||
const portfinder = require('portfinder')
|
|
||||||
|
|
||||||
const HOST = process.env.HOST
|
|
||||||
const PORT = process.env.PORT && Number(process.env.PORT)
|
|
||||||
|
|
||||||
const iconFontLoader = {
|
|
||||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
||||||
loader: 'url-loader',
|
|
||||||
options: {
|
|
||||||
limit: 10000,
|
|
||||||
name: utils.assetsPath('fonts/[name].[ext]')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const devWebpackConfig = merge(baseWebpackConfig, {
|
|
||||||
module: {
|
|
||||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true}).concat([iconFontLoader])
|
|
||||||
},
|
|
||||||
// cheap-module-eval-source-map is faster for development
|
|
||||||
devtool: config.dev.devtool,
|
|
||||||
|
|
||||||
// these devServer options should be customized in /config/index.js
|
|
||||||
devServer: {
|
|
||||||
clientLogLevel: 'warning',
|
|
||||||
historyApiFallback: {
|
|
||||||
rewrites: [
|
|
||||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
|
|
||||||
],
|
|
||||||
},
|
|
||||||
hot: true,
|
|
||||||
contentBase: false, // since we use CopyWebpackPlugin.
|
|
||||||
compress: true,
|
|
||||||
host: HOST || config.dev.host,
|
|
||||||
port: PORT || config.dev.port,
|
|
||||||
open: config.dev.autoOpenBrowser,
|
|
||||||
overlay: config.dev.errorOverlay
|
|
||||||
? { warnings: false, errors: true }
|
|
||||||
: false,
|
|
||||||
publicPath: config.dev.assetsPublicPath,
|
|
||||||
proxy: config.dev.proxyTable,
|
|
||||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
|
||||||
watchOptions: {
|
|
||||||
poll: config.dev.poll,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env': require('../config/dev.env')
|
|
||||||
}),
|
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
|
||||||
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
|
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
|
||||||
// https://github.com/ampedandwired/html-webpack-plugin
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: 'index.html',
|
|
||||||
template: 'index.html',
|
|
||||||
inject: true
|
|
||||||
}),
|
|
||||||
// copy custom static assets
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
{
|
|
||||||
from: path.resolve(__dirname, '../static'),
|
|
||||||
to: config.dev.assetsSubDirectory,
|
|
||||||
ignore: ['.*']
|
|
||||||
}
|
|
||||||
])
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports = new Promise((resolve, reject) => {
|
|
||||||
portfinder.basePort = process.env.PORT || config.dev.port
|
|
||||||
portfinder.getPort((err, port) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
} else {
|
|
||||||
// publish the new Port, necessary for e2e tests
|
|
||||||
process.env.PORT = port
|
|
||||||
// add port to devServer config
|
|
||||||
devWebpackConfig.devServer.port = port
|
|
||||||
|
|
||||||
// Add FriendlyErrorsPlugin
|
|
||||||
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
|
||||||
compilationSuccessInfo: {
|
|
||||||
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
|
|
||||||
},
|
|
||||||
onErrors: config.dev.notifyOnErrors
|
|
||||||
? utils.createNotifierCallback()
|
|
||||||
: undefined
|
|
||||||
}))
|
|
||||||
|
|
||||||
resolve(devWebpackConfig)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
|
@ -1,156 +0,0 @@
|
||||||
'use strict'
|
|
||||||
const path = require('path')
|
|
||||||
const utils = require('./utils')
|
|
||||||
const webpack = require('webpack')
|
|
||||||
const config = require('../config')
|
|
||||||
const merge = require('webpack-merge')
|
|
||||||
const baseWebpackConfig = require('./webpack.base.conf')
|
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
||||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
|
||||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
|
||||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
|
||||||
|
|
||||||
const env = require('../config/prod.env')
|
|
||||||
|
|
||||||
const iconFontLoader = {
|
|
||||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
||||||
loader:'url-loader',
|
|
||||||
options:{
|
|
||||||
limit: 10000,
|
|
||||||
outputPath: utils.assetsPath('fonts'),//决定打包出来的文件的路径 在 dist 下的路径
|
|
||||||
publicPath:'../fonts/',
|
|
||||||
name:'[name].[ext]'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const webpackConfig = merge(baseWebpackConfig, {
|
|
||||||
module: {
|
|
||||||
rules: utils.styleLoaders({
|
|
||||||
sourceMap: config.build.productionSourceMap,
|
|
||||||
extract: true,
|
|
||||||
usePostCSS: true
|
|
||||||
}).concat([iconFontLoader])
|
|
||||||
},
|
|
||||||
devtool: config.build.productionSourceMap ? config.build.devtool : false,
|
|
||||||
output: {
|
|
||||||
path: config.build.assetsRoot,
|
|
||||||
filename: utils.assetsPath('js/[name].js'),
|
|
||||||
chunkFilename: utils.assetsPath('js/[id].js')
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env': env
|
|
||||||
}),
|
|
||||||
new UglifyJsPlugin({
|
|
||||||
uglifyOptions: {
|
|
||||||
compress: {
|
|
||||||
warnings: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
sourceMap: config.build.productionSourceMap,
|
|
||||||
parallel: true
|
|
||||||
}),
|
|
||||||
// extract css into its own file
|
|
||||||
new ExtractTextPlugin({
|
|
||||||
filename: utils.assetsPath('css/[name].css'),
|
|
||||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
|
||||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
|
||||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
|
||||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
|
||||||
allChunks: true,
|
|
||||||
}),
|
|
||||||
// Compress extracted CSS. We are using this plugin so that possible
|
|
||||||
// duplicated CSS from different components can be deduped.
|
|
||||||
new OptimizeCSSPlugin({
|
|
||||||
cssProcessorOptions: config.build.productionSourceMap
|
|
||||||
? { safe: true, map: { inline: false } }
|
|
||||||
: { safe: true }
|
|
||||||
}),
|
|
||||||
// generate dist index.html with correct asset hash for caching.
|
|
||||||
// you can customize output by editing /index.html
|
|
||||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: config.build.index,
|
|
||||||
template: 'index.html',
|
|
||||||
inject: true,
|
|
||||||
minify: {
|
|
||||||
removeComments: true,
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true
|
|
||||||
// more options:
|
|
||||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
|
||||||
},
|
|
||||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
|
||||||
chunksSortMode: 'dependency'
|
|
||||||
}),
|
|
||||||
// keep module.id stable when vendor modules does not change
|
|
||||||
new webpack.HashedModuleIdsPlugin(),
|
|
||||||
// enable scope hoisting
|
|
||||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
|
||||||
// split vendor js into its own file
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
name: 'vendor',
|
|
||||||
minChunks (module) {
|
|
||||||
// any required modules inside node_modules are extracted to vendor
|
|
||||||
return (
|
|
||||||
module.resource &&
|
|
||||||
/\.js$/.test(module.resource) &&
|
|
||||||
module.resource.indexOf(
|
|
||||||
path.join(__dirname, '../node_modules')
|
|
||||||
) === 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
// extract webpack runtime and module manifest to its own file in order to
|
|
||||||
// prevent vendor hash from being updated whenever app bundle is updated
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
name: 'manifest',
|
|
||||||
minChunks: Infinity
|
|
||||||
}),
|
|
||||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
|
||||||
// in a separate chunk, similar to the vendor chunk
|
|
||||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
name: 'app',
|
|
||||||
async: 'vendor-async',
|
|
||||||
children: true,
|
|
||||||
minChunks: 3
|
|
||||||
}),
|
|
||||||
|
|
||||||
// copy custom static assets
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
{
|
|
||||||
from: path.resolve(__dirname, '../static'),
|
|
||||||
to: config.build.assetsSubDirectory,
|
|
||||||
ignore: ['.*']
|
|
||||||
}
|
|
||||||
])
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
if (config.build.productionGzip) {
|
|
||||||
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
|
||||||
|
|
||||||
webpackConfig.plugins.push(
|
|
||||||
new CompressionWebpackPlugin({
|
|
||||||
asset: '[path].gz[query]',
|
|
||||||
algorithm: 'gzip',
|
|
||||||
test: new RegExp(
|
|
||||||
'\\.(' +
|
|
||||||
config.build.productionGzipExtensions.join('|') +
|
|
||||||
')$'
|
|
||||||
),
|
|
||||||
threshold: 10240,
|
|
||||||
minRatio: 0.8
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config.build.bundleAnalyzerReport) {
|
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
|
||||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = webpackConfig
|
|
|
@ -1,7 +0,0 @@
|
||||||
'use strict'
|
|
||||||
const merge = require('webpack-merge')
|
|
||||||
const prodEnv = require('./prod.env')
|
|
||||||
|
|
||||||
module.exports = merge(prodEnv, {
|
|
||||||
NODE_ENV: '"development"'
|
|
||||||
})
|
|
|
@ -1,69 +0,0 @@
|
||||||
'use strict'
|
|
||||||
// Template version: 1.3.1
|
|
||||||
// see http://vuejs-templates.github.io/webpack for documentation.
|
|
||||||
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
dev: {
|
|
||||||
|
|
||||||
// Paths
|
|
||||||
assetsSubDirectory: 'static',
|
|
||||||
assetsPublicPath: '',
|
|
||||||
proxyTable: {},
|
|
||||||
|
|
||||||
// Various Dev Server settings
|
|
||||||
host: 'localhost', // can be overwritten by process.env.HOST
|
|
||||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
|
||||||
autoOpenBrowser: false,
|
|
||||||
errorOverlay: true,
|
|
||||||
notifyOnErrors: true,
|
|
||||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Source Maps
|
|
||||||
*/
|
|
||||||
|
|
||||||
// https://webpack.js.org/configuration/devtool/#development
|
|
||||||
devtool: 'cheap-module-eval-source-map',
|
|
||||||
|
|
||||||
// If you have problems debugging vue-files in devtools,
|
|
||||||
// set this to false - it *may* help
|
|
||||||
// https://vue-loader.vuejs.org/en/options.html#cachebusting
|
|
||||||
cacheBusting: true,
|
|
||||||
|
|
||||||
cssSourceMap: true
|
|
||||||
},
|
|
||||||
|
|
||||||
build: {
|
|
||||||
// Template for index.html
|
|
||||||
index: path.resolve(__dirname, '../dist/index.html'),
|
|
||||||
|
|
||||||
// Paths
|
|
||||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
|
||||||
assetsSubDirectory: 'static',
|
|
||||||
assetsPublicPath: '',
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Source Maps
|
|
||||||
*/
|
|
||||||
|
|
||||||
productionSourceMap: false,
|
|
||||||
// https://webpack.js.org/configuration/devtool/#production
|
|
||||||
devtool: '#source-map',
|
|
||||||
|
|
||||||
// Gzip off by default as many popular static hosts such as
|
|
||||||
// Surge or Netlify already gzip all static assets for you.
|
|
||||||
// Before setting to `true`, make sure to:
|
|
||||||
// npm install --save-dev compression-webpack-plugin
|
|
||||||
productionGzip: false,
|
|
||||||
productionGzipExtensions: ['js', 'css'],
|
|
||||||
|
|
||||||
// Run the build command with an extra argument to
|
|
||||||
// View the bundle analyzer report after build finishes:
|
|
||||||
// `npm run build --report`
|
|
||||||
// Set to `true` or `false` to always turn it on or off
|
|
||||||
bundleAnalyzerReport: process.env.npm_config_report
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
'use strict'
|
|
||||||
module.exports = {
|
|
||||||
NODE_ENV: '"production"'
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
79
package.json
79
package.json
|
@ -1,70 +1,53 @@
|
||||||
{
|
{
|
||||||
"name": "vkconfig",
|
"name": "vkconfig",
|
||||||
"version": "1.0.0",
|
"version": "0.1.0",
|
||||||
"description": "A Vue.js project",
|
|
||||||
"author": "ZaneYork <ZaneYork@qq.com>",
|
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
|
"serve": "vue-cli-service serve",
|
||||||
"start": "npm run dev",
|
"build": "vue-cli-service build",
|
||||||
"build": "node build/build.js"
|
"lint": "vue-cli-service lint",
|
||||||
|
"i18n:report": "vue-cli-service i18n:report --src './src/**/*.?(js|vue)' --locales './src/locales/**/*.json'"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"core-js": "^3.6.5",
|
||||||
"element-ui": "^2.13.2",
|
"element-ui": "^2.13.2",
|
||||||
"konva": "^7.1.4",
|
"konva": "^7.1.4",
|
||||||
"uuid": "^8.3.1",
|
"uuid": "^8.3.1",
|
||||||
"vue": "^2.5.2",
|
"vue": "^2.6.12",
|
||||||
"vue-i18n": "^8.22.1",
|
"vue-i18n": "^8.22.1",
|
||||||
"vue-konva": "^2.1.6"
|
"vue-konva": "^2.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"autoprefixer": "^7.1.2",
|
"@intlify/vue-i18n-loader": "^1.0.0",
|
||||||
"babel-core": "^6.22.1",
|
"@vue/cli-plugin-babel": "~4.5.0",
|
||||||
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||||
"babel-loader": "^7.1.1",
|
"@vue/cli-service": "~4.5.0",
|
||||||
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-plugin-component": "^1.1.1",
|
"babel-plugin-component": "^1.1.1",
|
||||||
"babel-plugin-import": "^1.13.1",
|
"eslint": "^6.7.2",
|
||||||
"babel-plugin-syntax-jsx": "^6.18.0",
|
"eslint-plugin-vue": "^6.2.2",
|
||||||
"babel-plugin-transform-runtime": "^6.22.0",
|
|
||||||
"babel-plugin-transform-vue-jsx": "^3.5.0",
|
|
||||||
"babel-preset-env": "^1.3.2",
|
|
||||||
"babel-preset-stage-2": "^6.22.0",
|
|
||||||
"chalk": "^2.0.1",
|
|
||||||
"copy-webpack-plugin": "^4.0.1",
|
|
||||||
"css-loader": "^0.28.0",
|
|
||||||
"extract-text-webpack-plugin": "^3.0.0",
|
|
||||||
"file-loader": "^1.1.4",
|
|
||||||
"friendly-errors-webpack-plugin": "^1.6.1",
|
|
||||||
"html-webpack-plugin": "^2.30.1",
|
|
||||||
"node-notifier": "^5.1.2",
|
|
||||||
"optimize-css-assets-webpack-plugin": "^3.2.0",
|
|
||||||
"ora": "^1.2.0",
|
|
||||||
"portfinder": "^1.0.13",
|
|
||||||
"postcss-import": "^11.0.0",
|
|
||||||
"postcss-loader": "^2.0.8",
|
|
||||||
"postcss-url": "^7.2.1",
|
|
||||||
"prettier": "^1.12.1",
|
|
||||||
"px2rem-loader": "^0.1.9",
|
"px2rem-loader": "^0.1.9",
|
||||||
"rimraf": "^2.6.0",
|
"vue-cli-plugin-element": "~1.0.1",
|
||||||
"semver": "^5.3.0",
|
"vue-cli-plugin-i18n": "~1.0.1",
|
||||||
"shelljs": "^0.7.6",
|
"vue-template-compiler": "^2.6.11"
|
||||||
"uglifyjs-webpack-plugin": "^1.1.1",
|
|
||||||
"url-loader": "^0.5.8",
|
|
||||||
"vue-loader": "^13.3.0",
|
|
||||||
"vue-style-loader": "^3.0.1",
|
|
||||||
"vue-template-compiler": "^2.5.2",
|
|
||||||
"webpack": "^3.6.0",
|
|
||||||
"webpack-bundle-analyzer": "^2.9.0",
|
|
||||||
"webpack-dev-server": "^2.9.1",
|
|
||||||
"webpack-merge": "^4.1.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"eslintConfig": {
|
||||||
"node": ">= 6.0.0",
|
"root": true,
|
||||||
"npm": ">= 3.0.0"
|
"env": {
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:vue/essential",
|
||||||
|
"eslint:recommended"
|
||||||
|
],
|
||||||
|
"parserOptions": {
|
||||||
|
"parser": "babel-eslint"
|
||||||
|
},
|
||||||
|
"rules": {}
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"> 1%",
|
"> 1%",
|
||||||
"last 2 versions",
|
"last 2 versions",
|
||||||
"not ie <= 8"
|
"not dead"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
}, getWidth: function () {
|
}, getWidth: function () {
|
||||||
return 1280;
|
return 1280;
|
||||||
}, getScale: function () {
|
}, getScale: function () {
|
||||||
return 0.2;
|
return 0.4;
|
||||||
}, isLandscape: function () {
|
}, isLandscape: function () {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
12
src/App.vue
12
src/App.vue
|
@ -5,14 +5,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import VirtualKeyboard from './components/VirtualKeyboard'
|
import VirtualKeyboard from './components/VirtualKeyboard'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
components: {
|
components: {
|
||||||
VirtualKeyboard
|
VirtualKeyboard
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
[
|
||||||
|
"None",
|
||||||
|
"MouseLeft",
|
||||||
|
"MouseRight",
|
||||||
|
"MouseMiddle",
|
||||||
|
"MouseX1",
|
||||||
|
"MouseX2",
|
||||||
|
"A",
|
||||||
|
"B",
|
||||||
|
"C",
|
||||||
|
"CapsLock",
|
||||||
|
"D",
|
||||||
|
"D0",
|
||||||
|
"D1",
|
||||||
|
"D2",
|
||||||
|
"D3",
|
||||||
|
"D4",
|
||||||
|
"D5",
|
||||||
|
"D6",
|
||||||
|
"D7",
|
||||||
|
"D8",
|
||||||
|
"D9",
|
||||||
|
"Decimal",
|
||||||
|
"Delete",
|
||||||
|
"Divide",
|
||||||
|
"Down",
|
||||||
|
"E",
|
||||||
|
"End",
|
||||||
|
"Enter",
|
||||||
|
"Escape",
|
||||||
|
"F",
|
||||||
|
"F1",
|
||||||
|
"F10",
|
||||||
|
"F11",
|
||||||
|
"F12",
|
||||||
|
"F2",
|
||||||
|
"F3",
|
||||||
|
"F4",
|
||||||
|
"F5",
|
||||||
|
"F6",
|
||||||
|
"F7",
|
||||||
|
"F8",
|
||||||
|
"F9",
|
||||||
|
"G",
|
||||||
|
"H",
|
||||||
|
"Help",
|
||||||
|
"Home",
|
||||||
|
"I",
|
||||||
|
"Insert",
|
||||||
|
"J",
|
||||||
|
"K",
|
||||||
|
"L",
|
||||||
|
"Left",
|
||||||
|
"LeftAlt",
|
||||||
|
"LeftControl",
|
||||||
|
"LeftShift",
|
||||||
|
"LeftWindows",
|
||||||
|
"M",
|
||||||
|
"Multiply",
|
||||||
|
"N",
|
||||||
|
"NumLock",
|
||||||
|
"NumPad0",
|
||||||
|
"NumPad1",
|
||||||
|
"NumPad2",
|
||||||
|
"NumPad3",
|
||||||
|
"NumPad4",
|
||||||
|
"NumPad5",
|
||||||
|
"NumPad6",
|
||||||
|
"NumPad7",
|
||||||
|
"NumPad8",
|
||||||
|
"NumPad9",
|
||||||
|
"O",
|
||||||
|
"OemBackslash",
|
||||||
|
"OemClear",
|
||||||
|
"OemCloseBrackets",
|
||||||
|
"OemComma",
|
||||||
|
"OemCopy",
|
||||||
|
"OemMinus",
|
||||||
|
"OemOpenBrackets",
|
||||||
|
"OemPeriod",
|
||||||
|
"OemPipe",
|
||||||
|
"OemPlus",
|
||||||
|
"OemQuestion",
|
||||||
|
"OemQuotes",
|
||||||
|
"OemSemicolon",
|
||||||
|
"OemTilde",
|
||||||
|
"P",
|
||||||
|
"PageDown",
|
||||||
|
"PageUp",
|
||||||
|
"Pause",
|
||||||
|
"Play",
|
||||||
|
"Print",
|
||||||
|
"PrintScreen",
|
||||||
|
"Q",
|
||||||
|
"R",
|
||||||
|
"Right",
|
||||||
|
"RightAlt",
|
||||||
|
"RightControl",
|
||||||
|
"RightShift",
|
||||||
|
"RightWindows",
|
||||||
|
"S",
|
||||||
|
"Scroll",
|
||||||
|
"Select",
|
||||||
|
"Separator",
|
||||||
|
"Sleep",
|
||||||
|
"Space",
|
||||||
|
"Subtract",
|
||||||
|
"T",
|
||||||
|
"Tab",
|
||||||
|
"U",
|
||||||
|
"Up",
|
||||||
|
"V",
|
||||||
|
"VolumeDown",
|
||||||
|
"VolumeMute",
|
||||||
|
"VolumeUp",
|
||||||
|
"W",
|
||||||
|
"X",
|
||||||
|
"Y",
|
||||||
|
"Z"
|
||||||
|
]
|
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
|
@ -15,16 +15,16 @@
|
||||||
</v-group>
|
</v-group>
|
||||||
</v-layer>
|
</v-layer>
|
||||||
<v-layer>
|
<v-layer>
|
||||||
<v-group v-for="button in config.buttons" :key="firstNotEmpty(button.id, button.key)"
|
<v-group v-for="button in buttonsWithoutCurrent" :key="firstNotEmpty(button.id, button.key)"
|
||||||
v-if="button.id !== currentButtonId" @tap="() => onActivated(button)"
|
@tap="() => onActivated(button)"
|
||||||
@click="() => onActivated(button)">
|
@click="() => onActivated(button)">
|
||||||
<v-rect :config="getButtonConfig(button, 'darkorange')"></v-rect>
|
<v-rect :config="getButtonConfig(button, 'darkorange')"></v-rect>
|
||||||
<v-text :config="getTextConfig(button, firstNotEmpty(button.alias, button.key))"></v-text>
|
<v-text :config="getTextConfig(button, firstNotEmpty(button.alias, button.key))"></v-text>
|
||||||
</v-group>
|
</v-group>
|
||||||
</v-layer>
|
</v-layer>
|
||||||
<v-layer v-if="toggleState">
|
<v-layer v-if="toggleState">
|
||||||
<v-group v-for="button in config.buttonsExtend" :key="firstNotEmpty(button.id, button.key)"
|
<v-group v-for="button in buttonsExtendWithoutCurrent" :key="firstNotEmpty(button.id, button.key)"
|
||||||
v-if="button.id !== currentButtonId" @tap="() => onActivated(button)"
|
@tap="() => onActivated(button)"
|
||||||
@click="() => onActivated(button)">
|
@click="() => onActivated(button)">
|
||||||
<v-rect :config="getButtonConfig(button, 'lightyellow')"></v-rect>
|
<v-rect :config="getButtonConfig(button, 'lightyellow')"></v-rect>
|
||||||
<v-text :config="getTextConfig(button, firstNotEmpty(button.alias, button.key))"></v-text>
|
<v-text :config="getTextConfig(button, firstNotEmpty(button.alias, button.key))"></v-text>
|
||||||
|
@ -146,6 +146,7 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {v4 as uuidv4} from 'uuid';
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import hintKeys from '../assets/hint-keys.json';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: function () {
|
data: function () {
|
||||||
|
@ -167,132 +168,25 @@
|
||||||
rectangle: {X: 0, Y: 0, Width: 90, Height: 90},
|
rectangle: {X: 0, Y: 0, Width: 90, Height: 90},
|
||||||
transparency: 0.5
|
transparency: 0.5
|
||||||
},
|
},
|
||||||
options: [
|
options: hintKeys.map(key => {
|
||||||
{label: "None", value: "None"},
|
return {label: key, value: key}
|
||||||
{label: "MouseLeft", value: "MouseLeft"},
|
}),
|
||||||
{label: "MouseRight", value: "MouseRight"},
|
|
||||||
{label: "MouseMiddle", value: "MouseMiddle"},
|
|
||||||
{label: "MouseX1", value: "MouseX1"},
|
|
||||||
{label: "MouseX2", value: "MouseX2"},
|
|
||||||
{label: "A", value: "A"},
|
|
||||||
{label: "B", value: "B"},
|
|
||||||
{label: "C", value: "C"},
|
|
||||||
{label: "CapsLock", value: "CapsLock"},
|
|
||||||
{label: "D", value: "D"},
|
|
||||||
{label: "D0", value: "D0"},
|
|
||||||
{label: "D1", value: "D1"},
|
|
||||||
{label: "D2", value: "D2"},
|
|
||||||
{label: "D3", value: "D3"},
|
|
||||||
{label: "D4", value: "D4"},
|
|
||||||
{label: "D5", value: "D5"},
|
|
||||||
{label: "D6", value: "D6"},
|
|
||||||
{label: "D7", value: "D7"},
|
|
||||||
{label: "D8", value: "D8"},
|
|
||||||
{label: "D9", value: "D9"},
|
|
||||||
{label: "Decimal", value: "Decimal"},
|
|
||||||
{label: "Delete", value: "Delete"},
|
|
||||||
{label: "Divide", value: "Divide"},
|
|
||||||
{label: "Down", value: "Down"},
|
|
||||||
{label: "E", value: "E"},
|
|
||||||
{label: "End", value: "End"},
|
|
||||||
{label: "Enter", value: "Enter"},
|
|
||||||
{label: "Escape", value: "Escape"},
|
|
||||||
{label: "F", value: "F"},
|
|
||||||
{label: "F1", value: "F1"},
|
|
||||||
{label: "F10", value: "F10"},
|
|
||||||
{label: "F11", value: "F11"},
|
|
||||||
{label: "F12", value: "F12"},
|
|
||||||
{label: "F2", value: "F2"},
|
|
||||||
{label: "F3", value: "F3"},
|
|
||||||
{label: "F4", value: "F4"},
|
|
||||||
{label: "F5", value: "F5"},
|
|
||||||
{label: "F6", value: "F6"},
|
|
||||||
{label: "F7", value: "F7"},
|
|
||||||
{label: "F8", value: "F8"},
|
|
||||||
{label: "F9", value: "F9"},
|
|
||||||
{label: "G", value: "G"},
|
|
||||||
{label: "H", value: "H"},
|
|
||||||
{label: "Help", value: "Help"},
|
|
||||||
{label: "Home", value: "Home"},
|
|
||||||
{label: "I", value: "I"},
|
|
||||||
{label: "Insert", value: "Insert"},
|
|
||||||
{label: "J", value: "J"},
|
|
||||||
{label: "K", value: "K"},
|
|
||||||
{label: "L", value: "L"},
|
|
||||||
{label: "Left", value: "Left"},
|
|
||||||
{label: "LeftAlt", value: "LeftAlt"},
|
|
||||||
{label: "LeftControl", value: "LeftControl"},
|
|
||||||
{label: "LeftShift", value: "LeftShift"},
|
|
||||||
{label: "LeftWindows", value: "LeftWindows"},
|
|
||||||
{label: "M", value: "M"},
|
|
||||||
{label: "Multiply", value: "Multiply"},
|
|
||||||
{label: "N", value: "N"},
|
|
||||||
{label: "NumLock", value: "NumLock"},
|
|
||||||
{label: "NumPad0", value: "NumPad0"},
|
|
||||||
{label: "NumPad1", value: "NumPad1"},
|
|
||||||
{label: "NumPad2", value: "NumPad2"},
|
|
||||||
{label: "NumPad3", value: "NumPad3"},
|
|
||||||
{label: "NumPad4", value: "NumPad4"},
|
|
||||||
{label: "NumPad5", value: "NumPad5"},
|
|
||||||
{label: "NumPad6", value: "NumPad6"},
|
|
||||||
{label: "NumPad7", value: "NumPad7"},
|
|
||||||
{label: "NumPad8", value: "NumPad8"},
|
|
||||||
{label: "NumPad9", value: "NumPad9"},
|
|
||||||
{label: "O", value: "O"},
|
|
||||||
{label: "OemBackslash", value: "OemBackslash"},
|
|
||||||
{label: "OemClear", value: "OemClear"},
|
|
||||||
{label: "OemCloseBrackets", value: "OemCloseBrackets"},
|
|
||||||
{label: "OemComma", value: "OemComma"},
|
|
||||||
{label: "OemCopy", value: "OemCopy"},
|
|
||||||
{label: "OemMinus", value: "OemMinus"},
|
|
||||||
{label: "OemOpenBrackets", value: "OemOpenBrackets"},
|
|
||||||
{label: "OemPeriod", value: "OemPeriod"},
|
|
||||||
{label: "OemPipe", value: "OemPipe"},
|
|
||||||
{label: "OemPlus", value: "OemPlus"},
|
|
||||||
{label: "OemQuestion", value: "OemQuestion"},
|
|
||||||
{label: "OemQuotes", value: "OemQuotes"},
|
|
||||||
{label: "OemSemicolon", value: "OemSemicolon"},
|
|
||||||
{label: "OemTilde", value: "OemTilde"},
|
|
||||||
{label: "P", value: "P"},
|
|
||||||
{label: "PageDown", value: "PageDown"},
|
|
||||||
{label: "PageUp", value: "PageUp"},
|
|
||||||
{label: "Pause", value: "Pause"},
|
|
||||||
{label: "Play", value: "Play"},
|
|
||||||
{label: "Print", value: "Print"},
|
|
||||||
{label: "PrintScreen", value: "PrintScreen"},
|
|
||||||
{label: "Q", value: "Q"},
|
|
||||||
{label: "R", value: "R"},
|
|
||||||
{label: "Right", value: "Right"},
|
|
||||||
{label: "RightAlt", value: "RightAlt"},
|
|
||||||
{label: "RightControl", value: "RightControl"},
|
|
||||||
{label: "RightShift", value: "RightShift"},
|
|
||||||
{label: "RightWindows", value: "RightWindows"},
|
|
||||||
{label: "S", value: "S"},
|
|
||||||
{label: "Scroll", value: "Scroll"},
|
|
||||||
{label: "Select", value: "Select"},
|
|
||||||
{label: "Separator", value: "Separator"},
|
|
||||||
{label: "Sleep", value: "Sleep"},
|
|
||||||
{label: "Space", value: "Space"},
|
|
||||||
{label: "Subtract", value: "Subtract"},
|
|
||||||
{label: "T", value: "T"},
|
|
||||||
{label: "Tab", value: "Tab"},
|
|
||||||
{label: "U", value: "U"},
|
|
||||||
{label: "Up", value: "Up"},
|
|
||||||
{label: "V", value: "V"},
|
|
||||||
{label: "VolumeDown", value: "VolumeDown"},
|
|
||||||
{label: "VolumeMute", value: "VolumeMute"},
|
|
||||||
{label: "VolumeUp", value: "VolumeUp"},
|
|
||||||
{label: "W", value: "W"},
|
|
||||||
{label: "X", value: "X"},
|
|
||||||
{label: "Y", value: "Y"},
|
|
||||||
{label: "Z", value: "Z"}
|
|
||||||
],
|
|
||||||
config: {}
|
config: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
color: function () {
|
color: function () {
|
||||||
return 'rgba(255,171,0,' + this.currentButton.transparency + ')';
|
return 'rgba(255,171,0,' + this.currentButton.transparency + ')';
|
||||||
|
},
|
||||||
|
buttonsWithoutCurrent: function () {
|
||||||
|
if(!this.config.buttons)
|
||||||
|
return {}
|
||||||
|
return this.config.buttons.filter(item => item.id !== this.currentButtonId);
|
||||||
|
},
|
||||||
|
buttonsExtendWithoutCurrent: function () {
|
||||||
|
if(!this.config.buttonsExtend)
|
||||||
|
return {}
|
||||||
|
return this.config.buttonsExtend.filter(item => item.id !== this.currentButtonId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import VueI18n from 'vue-i18n'
|
||||||
|
import ElementLocale from 'element-ui/lib/locale'
|
||||||
|
import enLocale from 'element-ui/lib/locale/lang/en'
|
||||||
|
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
|
||||||
|
|
||||||
|
Vue.use(VueI18n)
|
||||||
|
|
||||||
|
function loadLocaleMessages() {
|
||||||
|
const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i)
|
||||||
|
const messages = {}
|
||||||
|
locales.keys().forEach(key => {
|
||||||
|
const matched = key.match(/([A-Za-z0-9-_]+)\./i)
|
||||||
|
if (matched && matched.length > 1) {
|
||||||
|
const locale = matched[1]
|
||||||
|
messages[locale] = locales(key)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
messages['en'] = {...messages['en'], ...enLocale};
|
||||||
|
messages['zh'] = {...messages['zh'], ...zhLocale};
|
||||||
|
return messages
|
||||||
|
}
|
||||||
|
|
||||||
|
const i18n = new VueI18n({
|
||||||
|
locale: process.env.VUE_APP_I18N_LOCALE || 'en',
|
||||||
|
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en',
|
||||||
|
messages: loadLocaleMessages()
|
||||||
|
});
|
||||||
|
ElementLocale.i18n((key, value) => i18n.t(key, value))
|
||||||
|
|
||||||
|
export default i18n;
|
|
@ -1,35 +0,0 @@
|
||||||
import enLocale from 'element-ui/lib/locale/lang/en'
|
|
||||||
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
|
|
||||||
|
|
||||||
const messages = {
|
|
||||||
en: {
|
|
||||||
toggle: "Toggle",
|
|
||||||
add: "ADD",
|
|
||||||
remove: "REMOVE",
|
|
||||||
key: "Key",
|
|
||||||
alias: "Alias",
|
|
||||||
command: "Command",
|
|
||||||
transparency: "Transparency",
|
|
||||||
X: "X",
|
|
||||||
Y: "Y",
|
|
||||||
Width: "Width",
|
|
||||||
Height: "Height",
|
|
||||||
...enLocale
|
|
||||||
},
|
|
||||||
"zh-CN": {
|
|
||||||
toggle: "切换",
|
|
||||||
add: "新增",
|
|
||||||
remove: "移除",
|
|
||||||
key: "按键",
|
|
||||||
alias: "别名",
|
|
||||||
command: "命令",
|
|
||||||
transparency: "透明度",
|
|
||||||
X: "X",
|
|
||||||
Y: "Y",
|
|
||||||
Width: "宽",
|
|
||||||
Height: "高",
|
|
||||||
...zhLocale
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default messages;
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"toggle": "Toggle",
|
||||||
|
"add": "ADD",
|
||||||
|
"remove": "REMOVE",
|
||||||
|
"key": "Key",
|
||||||
|
"alias": "Alias",
|
||||||
|
"command": "Command",
|
||||||
|
"transparency": "Transparency",
|
||||||
|
"X": "X",
|
||||||
|
"Y": "Y",
|
||||||
|
"Width": "Width",
|
||||||
|
"Height": "Height"
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"toggle": "切换",
|
||||||
|
"add": "新增",
|
||||||
|
"remove": "移除",
|
||||||
|
"key": "按键",
|
||||||
|
"alias": "别名",
|
||||||
|
"command": "命令",
|
||||||
|
"transparency": "透明度",
|
||||||
|
"X": "X",
|
||||||
|
"Y": "Y",
|
||||||
|
"Width": "宽",
|
||||||
|
"Height": "高"
|
||||||
|
}
|
54
src/main.js
54
src/main.js
|
@ -1,60 +1,20 @@
|
||||||
// The Vue build version to load with the `import` command
|
|
||||||
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
|
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App'
|
import App from './App.vue'
|
||||||
import VueI18n from 'vue-i18n'
|
import i18n from './i18n'
|
||||||
import messages from "./i18n/messages";
|
import './plugins/element.js'
|
||||||
import {
|
import './plugins/vue-konva.js'
|
||||||
Row,
|
|
||||||
Col,
|
|
||||||
Button,
|
|
||||||
Autocomplete,
|
|
||||||
Option,
|
|
||||||
Input,
|
|
||||||
Slider,
|
|
||||||
ColorPicker,
|
|
||||||
Form,
|
|
||||||
FormItem,
|
|
||||||
Drawer
|
|
||||||
} from 'element-ui';
|
|
||||||
import ElementLocale from 'element-ui/lib/locale'
|
|
||||||
import VueKonva from 'vue-konva'
|
|
||||||
|
|
||||||
// register component to use
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
Vue.use(VueI18n)
|
|
||||||
|
|
||||||
Vue.use(VueKonva)
|
|
||||||
Vue.component(Row.name, Row,);
|
|
||||||
Vue.component(Col.name, Col);
|
|
||||||
Vue.component(Button.name, Button);
|
|
||||||
Vue.component(Autocomplete.name, Autocomplete);
|
|
||||||
Vue.component(Option.name, Option);
|
|
||||||
Vue.component(Input.name, Input);
|
|
||||||
Vue.component(Slider.name, Slider);
|
|
||||||
Vue.component(ColorPicker.name, ColorPicker);
|
|
||||||
Vue.component(Form.name, Form);
|
|
||||||
Vue.component(FormItem.name, FormItem);
|
|
||||||
Vue.component(Drawer.name, Drawer);
|
|
||||||
ElementLocale.i18n((key, value) => i18n.t(key, value))
|
|
||||||
|
|
||||||
const i18n = new VueI18n({
|
|
||||||
locale: navigator.language, // set locale
|
|
||||||
messages, // set locale messages
|
|
||||||
})
|
|
||||||
window.onresize = setHtmlFontSize;
|
window.onresize = setHtmlFontSize;
|
||||||
|
|
||||||
function setHtmlFontSize() {
|
function setHtmlFontSize() {
|
||||||
const htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
|
const htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
|
||||||
const htmlDom = document.getElementsByTagName('html')[0];
|
const htmlDom = document.getElementsByTagName('html')[0];
|
||||||
htmlDom.style.fontSize = htmlWidth / 10 + 'px';
|
htmlDom.style.fontSize = htmlWidth / 10 + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
setHtmlFontSize();
|
setHtmlFontSize();
|
||||||
/* eslint-disable no-new */
|
|
||||||
new Vue({
|
new Vue({
|
||||||
i18n,
|
i18n,
|
||||||
el: '#app',
|
render: h => h(App)
|
||||||
components: {App},
|
}).$mount('#app')
|
||||||
template: '<App/>'
|
|
||||||
})
|
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import {
|
||||||
|
Row,
|
||||||
|
Col,
|
||||||
|
Button,
|
||||||
|
Autocomplete,
|
||||||
|
Option,
|
||||||
|
Input,
|
||||||
|
Slider,
|
||||||
|
ColorPicker,
|
||||||
|
Form,
|
||||||
|
FormItem,
|
||||||
|
Drawer
|
||||||
|
} from 'element-ui';
|
||||||
|
|
||||||
|
Vue.component(Row.name, Row,);
|
||||||
|
Vue.component(Col.name, Col);
|
||||||
|
Vue.component(Button.name, Button);
|
||||||
|
Vue.component(Autocomplete.name, Autocomplete);
|
||||||
|
Vue.component(Option.name, Option);
|
||||||
|
Vue.component(Input.name, Input);
|
||||||
|
Vue.component(Slider.name, Slider);
|
||||||
|
Vue.component(ColorPicker.name, ColorPicker);
|
||||||
|
Vue.component(Form.name, Form);
|
||||||
|
Vue.component(FormItem.name, FormItem);
|
||||||
|
Vue.component(Drawer.name, Drawer);
|
|
@ -0,0 +1,3 @@
|
||||||
|
import Vue from 'vue'
|
||||||
|
import VueKonva from 'vue-konva'
|
||||||
|
Vue.use(VueKonva)
|
|
@ -0,0 +1,39 @@
|
||||||
|
module.exports = {
|
||||||
|
pluginOptions: {
|
||||||
|
i18n: {
|
||||||
|
locale: 'en',
|
||||||
|
fallbackLocale: 'en',
|
||||||
|
localeDir: 'locales',
|
||||||
|
enableInSFC: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
publicPath: process.env.NODE_ENV === 'production' ? '' : '/',
|
||||||
|
productionSourceMap: false,
|
||||||
|
chainWebpack: config => {
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
config.output.filename('js/[name].js').end();
|
||||||
|
config.output.chunkFilename('js/[name].js').end();
|
||||||
|
// 修改生产配置
|
||||||
|
config.plugin('extract-css').tap(() => [{
|
||||||
|
filename: `css/[name].css`,
|
||||||
|
chunkFilename: `css/[name].css`
|
||||||
|
}])
|
||||||
|
}
|
||||||
|
config.module
|
||||||
|
.rule('fonts')
|
||||||
|
.use('url-loader')
|
||||||
|
.loader('url-loader')
|
||||||
|
.tap(options => {
|
||||||
|
options.fallback.options.name = 'fonts/[name].[ext]';
|
||||||
|
return options
|
||||||
|
});
|
||||||
|
// px2rem-loader
|
||||||
|
config.module
|
||||||
|
.rule('px2rem-loader')
|
||||||
|
.test(/\.css$/)
|
||||||
|
.use('px2rem-loader')
|
||||||
|
.loader('px2rem-loader')
|
||||||
|
.options({remUnit: 75})
|
||||||
|
.end()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue