Commit 528160dc authored by malin's avatar malin

init

parent de52626c
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"]
}
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
.DS_Store
node_modules/
/dist/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
// 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": {}
}
}
# y
> y
## Build Setup
``` bash
# install dependencies
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).
'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'
))
})
})
'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)
}
}
'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
}
}
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [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')
})
}
}
'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'
}
}
'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]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[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'
}
}
'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 devWebpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
},
// 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)
}
})
})
'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 webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
extract: true,
usePostCSS: true
})
},
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].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].[contenthash].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
'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')
console.log("dev.env.js", process.argv);
module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
BASE_API: '"https://feedapitest.zhangxinhulian.com"'
})
'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
host: '192.168.1.110', // 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: true,
// 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
}
}
'use strict'
const idx = process.argv.indexOf("test");
let BASE_API =
idx > 0
? '"https://feedapitest.zhangxinhulian.com"'
: '"https://feedapi.zhangxinhulian.com"';
console.log("prod.env.js", process.argv);
module.exports = {
NODE_ENV: '"production"',
BASE_API: BASE_API
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1">
<title>宝宝起名</title>
<script>"use strict"; !function e(t, n, r) { function i(d, a) { if (!n[d]) { if (!t[d]) { var f = "function" == typeof require && require; if (!a && f) return f(d, !0); if (o) return o(d, !0); throw new Error("Cannot find module '" + d + "'") } var s = n[d] = { exports: {} }; t[d][0].call(s.exports, function (e) { var n = t[d][1][e]; return i(n || e) }, s, s.exports, e, t, n, r) } return n[d].exports } for (var o = "function" == typeof require && require, d = 0; d < r.length; d++)i(r[d]); return i }({ 1: [function (e, t, n) { !function (e, t) { function n() { t.body ? t.body.style.fontSize = 12 * o + "px" : t.addEventListener("DOMContentLoaded", n) } function r() { var e = i.clientWidth / (window.FLEX_RATIO || 7.5); i.style.fontSize = e + "px" } var i = t.documentElement, o = e.devicePixelRatio || 1; if (n(), r(), e.addEventListener("resize", r), e.addEventListener("pageshow", function (e) { e.persisted && r() }), o >= 2) { var d = t.createElement("body"), a = t.createElement("div"); a.style.border = ".5px solid transparent", d.appendChild(a), i.appendChild(d), 1 === a.offsetHeight && i.classList.add("hairlines"), i.removeChild(d) } }(window, document) }, {}] }, {}, [1]);</script>
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
<script>
(function () {
document.documentElement.style.fontSize = window.innerWidth / 7.5 + 'px'; //1rem = 100px
document.body.style.fontSize = '14px';// 在body上将字体还原大小,避免页面无样式字体超大
})()
</script>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
{
"name": "y",
"version": "1.0.0",
"description": "y",
"author": "y",
"private": true,
"scripts": {
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
"start": "npm run dev",
"build": "node build/build.js"
},
"dependencies": {
"axios": "^0.21.1",
"vue": "^2.5.2",
"vue-router": "^3.0.1"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"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",
"rimraf": "^2.6.0",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"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": {
"node": ">= 6.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
<template>
<div id="app">
<!-- <img src="./assets/logo.png"> -->
<router-view />
</div>
</template>
<script>
export default {
name: "App",
};
</script>
<style>
/* #app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
} */
html,
body,
#app {
height: 100%;
}
/* html {
font-size: 100px;
} */
html,
body,
div,
span {
margin: 0;
padding: 0;
border: 0;
}
span {
line-height: 1;
}
img {
display: block;
}
input {
display: block;
box-sizing: border-box;
line-height: inherit;
background-color: transparent;
margin: 0;
padding: 0;
border: 0;
outline: none;
}
</style>
import request from '@/service/request'
\ No newline at end of file
.fc-0 {
color: #000000;
}
.fc-f {
color: #fff;
}
\ No newline at end of file
.ff-pp {
font-family: PingFangSC-Medium, PingFang SC;
}
\ No newline at end of file
.fs-36 {
font-size: 0.36rem;
}
.fs-40 {
font-size: 0.4rem;
}
\ No newline at end of file
.fw-5 {
font-weight: 500;
}
\ No newline at end of file
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<h2>Essential Links</h2>
<ul>
<li>
<a
href="https://vuejs.org"
target="_blank"
>
Core Docs
</a>
</li>
<li>
<a
href="https://forum.vuejs.org"
target="_blank"
>
Forum
</a>
</li>
<li>
<a
href="https://chat.vuejs.org"
target="_blank"
>
Community Chat
</a>
</li>
<li>
<a
href="https://twitter.com/vuejs"
target="_blank"
>
Twitter
</a>
</li>
<br>
<li>
<a
href="http://vuejs-templates.github.io/webpack/"
target="_blank"
>
Docs for This Template
</a>
</li>
</ul>
<h2>Ecosystem</h2>
<ul>
<li>
<a
href="http://router.vuejs.org/"
target="_blank"
>
vue-router
</a>
</li>
<li>
<a
href="http://vuex.vuejs.org/"
target="_blank"
>
vuex
</a>
</li>
<li>
<a
href="http://vue-loader.vuejs.org/"
target="_blank"
>
vue-loader
</a>
</li>
<li>
<a
href="https://github.com/vuejs/awesome-vue"
target="_blank"
>
awesome-vue
</a>
</li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
<template>
<div class="status-bar">
<slot></slot>
</div>
</template>
<script>
export default {};
</script>
<style scoped>
.status-bar {
/* display: block; */
width: 100%;
height: 1.28rem;
background-color: #fff;
/* position: fixed; */
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 1px 5px #ccc;
}
</style>
\ No newline at end of file
// 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 App from './App'
import router from './router'
Vue.config.productionTip = false
import './assets/css/font-color.css'
import './assets/css/font-size.css'
import './assets/css/font-family.css'
import './assets/css/font-weight.css'
// 路由发生变化修改页面title
router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title;
}
next();
});
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
components: { App },
template: '<App/>'
})
import Vue from 'vue'
import Router from 'vue-router'
import routes from './routes'
Vue.use(Router)
export default new Router({
routes,
mode: "history", //历史模式
// * 不是所有流浪器都支持 history 模式,如果遇到不支持的时候,需要设置 fallback 为 true,它会自动帮我们转成哈希去处理
// * 如果你设置成 false,在不支持的情况下,那么单应用就会变成多应用,你每次路由跳转都会去后端然后返回新的内容,所以一般都是设置成 ture 要它去自动处理就好了
fallback: true,
// * 未添加 base: 链接与(未添加 mode || 添加 mode)时无变化
// * 添加 base: http://localhost:8080/base/login
base: process.env.BASE_URL,
// * linkActiveClass & linkExactActiveClass 这两个都是用来配置可点击链接的类名的
// * 例如: <router-link to="/login">跳转Login</router-link>
// * 在源码中默认是这么显示的: <a href="/login" class="router-link-exact-active router-link-active">跳转Login</a>
// * 可以看到里面的 class 默认是 router-link-exact-active 以及 router-link-active
// * 但是如果使用下面的两个属性配置之后则会显示成:<a href="/login" class="exact-active-link active-link">跳转Login</a>
// * 可以看到里面的 class 现在是 exact-active-link 以及 active-link
// * 这样就方便我们自己自定义类名了
linkActiveClass: "active-link",
linkExactActiveClass: "exact-active-link",
scrollBehavior(to, form, savedPosition) {
//scrollBehavior方法接收to,form路由对象
//第三个参数savedPosition当且仅当在浏览器前进后退按钮触发时才可用
//该方法会返回滚动位置的对象信息,如果返回false,或者是一个空的对象,那么不会发生滚动
//我们可以在该方法中设置返回值来指定页面的滚动位置,例如:
return { x: 0, y: 0 };
//表示在用户切换路由时让是所有页面都返回到顶部位置
//如果返回savedPosition,那么在点击后退按钮时就会表现的像原生浏览器一样,返回的页面会滚动过到之前按钮点击跳转的位置,大概写法如下:
if (savedPosition) {
return savedPosition;
} else {
return { x: 0, y: 0 };
}
//如果想要模拟滚动到锚点的行为:
if (to.hash) {
return {
selector: to.hash
};
}
// * 什么叫Query? 就是 http://localhost:8080/login?a=xxx&p=xxx 链接 ?后面的搜索参数
// * 如果有什么特殊需求可以通过这两个函数进行自定义
// parseQuery (query) {
// // 接收到的参数 query 是一个字符串
// },
// stringifyQuery (obj) {
// // 接收到的参数 obj 是一个对象
// }
}
})
const routes = [
{
path: "/",
redirect: "/Index"
},
{
path: "/Index",
name: "Index",
component: resolve => require(["@/views/Home"], resolve) // 宝宝起名首页
},
]
export default routes
\ No newline at end of file
import axios from 'axios'
let baseURL = "https://feedapi.zhangxinhulian.com";
if (process.env.NODE_ENV === "development") {
baseURL = "https://feedapitest.zhangxinhulian.com";
} else {
baseURL = "https://feedapi.zhangxinhulian.com";
}
// 创建axios实例
const request = axios.create({
baseURL: baseURL,
withCredentials: false, //设置cross跨域 并设置访问权限 允许跨域携带cookie信息
timeout: 5000, // 请求超时时间
retryDelay: 1000, //重试间隔
retry: 3 //重试次数
});
request.interceptors.response.use(
function (response) {
return Promise.resolve(response.data); //请求正常则返回
},
function (error) {
return Promise.reject(error); //请求错误
}
);
export default request;
\ No newline at end of file
<template>
<div>
<div class="form">
<img class="img4" src="~@/assets/img/home/img4.png" alt="" />
<div class="baby-form">
<div>
<span>宝宝姓氏</span>
<input type="text" placeholder="请输入宝宝姓氏" />
</div>
<div>
<span>宝宝性别</span>
<input type="text" />
</div>
<div>
<span>出生日期</span>
<input type="text" placeholder="请选择出生日期或预产期" />
</div>
</div>
</div>
<div class="btn fs-40 fc-f ff-pp">立即起名</div>
</div>
</template>
<script>
export default {};
</script>
<style>
.form {
width: 7.5rem;
height: 4.4rem;
position: relative;
background-color: #fff;
}
.btn {
widows: 7.5rem;
height: 0.92rem;
display: flex;
justify-content: center;
align-items: center;
background-color: #ffa3cf;
border-radius: 0 0 0.4rem 0.4rem;
}
.img4 {
width: 6.42rem;
height: 0.42rem;
position: absolute;
top: 0.4rem;
left: 50%;
transform: translateX(-50%);
}
.baby-form {
position: absolute;
top: 1.82rem;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.baby-form > div {
width: 100%;
display: flex;
justify-content: space-around;
align-items: center;
}
.baby-form > div:nth-child(2) {
margin: 0.4rem 0;
}
.baby-form input {
width: 3.96rem;
height: 0.36rem;
padding: 0 0.1rem;
}
.baby-form input:focus {
border: 1px solid #ffa3cf;
border-radius: 5px;
}
.baby-form span {
font-size: 0.36rem;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
line-height: 0.36rem;
margin-right: -1rem;
}
</style>
\ No newline at end of file
#home {
width: 100%;
position: relative;
}
#home-body {
width: 100%;
position: relative;
background: url(~@/assets/img/home/bg1.png) no-repeat;
background-size: cover;
background-color: #DBF3FE;
}
.mother-begin {
margin-top: 0.12px;
}
.img1 {
width: 7.5rem;
height: 6.6rem;
}
.img2 {
position: absolute;
top: 0.68rem;
right: 0.6rem;
width: 4.1rem;
height: 0.52rem;
}
.img3 {
position: absolute;
top: 1.44rem;
right: 0.08rem;
width: 5.16rem;
height: 0.52rem;
}
.img5-parent {
width: 100%;
height: 2.44rem;
margin-top: 0.5rem;
display: flex;
justify-content: center;
align-items: center;
}
.img5 {
width: 5.94rem;
height: 2.44rem;
}
.img6-parent {
width: 100%;
height: 0.56rem;
margin-top: 0.8rem;
display: flex;
justify-content: center;
align-items: center;
}
.img6 {
width: 3.72rem;
height: 0.56rem;
}
.img7-parent {
position: relative;
width: 100%;
height: 5.6rem;
margin-top: 0.6rem;
display: flex;
justify-content: center;
align-items: center;
}
.img7 {
width: 5.6rem;
height: 5.6rem;
}
.img8 {
width: 4.2rem;
height: 4.2rem;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
.img9-parent {
width: 100%;
height: 0.56rem;
margin-top: 1rem;
display: flex;
justify-content: center;
align-items: center;
}
.img9 {
width: 4.14rem;
height: 0.56rem;
}
.img10-parent {
width: 100%;
height: 4.08rem;
margin-top: 0.4rem;
display: flex;
justify-content: center;
align-items: center;
}
.img10 {
width: 7.48rem;
height: 4.08rem;
}
.img11-parent {
width: 100%;
height: 0.56rem;
margin-top: 0.8rem;
display: flex;
justify-content: center;
align-items: center;
}
.img11 {
width: 4.18rem;
height: 0.56rem;
}
.img-flex {
width: 100%;
margin-top: 0.4rem;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.img-flex>div {
width: 33.33%;
display: flex;
justify-content: center;
align-items: center;
}
.img-flex>div:nth-child(n+4) {
margin-top: 0.4rem;
}
.img-flex img {
width: 1.86rem;
height: 0.78rem;
}
.img17-parent {
width: 100%;
height: 0.56rem;
margin-top: 0.8rem;
display: flex;
justify-content: center;
align-items: center;
}
.img17 {
width: 4.8rem;
height: 0.56rem;
}
.bottom-img {
width: 100%;
height: 4.22rem;
margin-top: 0.4rem;
display: flex;
justify-content: space-around;
align-items: center;
}
.bottom-img img {
width: 2.36rem;
height: 4.22rem;
}
.tab-bar {
width: 100%;
height: 0.56rem;
}
\ No newline at end of file
<template>
<div id="home">
<!-- 状态栏 -->
<status-bar>
<span class="fs-36 fc-0 ff-pp fw-5">宝宝起名</span>
</status-bar>
<div id="home-body">
<div class="mother-begin">
<img class="img1" src="~@/assets/img/home/img1.png" alt="" />
<img class="img2" src="~@/assets/img/home/img2.png" alt="" />
<img class="img3" src="~@/assets/img/home/img3.png" alt="" />
</div>
<!-- 查询表单 -->
<form-query />
<div class="img5-parent">
<img class="img5" src="~@/assets/img/home/img5.png" alt="" />
</div>
<div class="img6-parent">
<img class="img6" src="~@/assets/img/home/img6.png" alt="" />
</div>
<div class="img7-parent">
<img class="img7" src="~@/assets/img/home/img7.png" alt="" />
<img class="img8" src="~@/assets/img/home/img8.png" alt="" />
</div>
<div class="img9-parent">
<img class="img9" src="~@/assets/img/home/img9.png" alt="" />
</div>
<div class="img10-parent">
<img class="img10" src="~@/assets/img/home/img10.png" alt="" />
</div>
<div class="img11-parent">
<img class="img11" src="~@/assets/img/home/img11.png" alt="" />
</div>
<div class="img-flex">
<div>
<img class="img12" src="~@/assets/img/home/img12.png" alt="" />
</div>
<div>
<img class="img13" src="~@/assets/img/home/img13.png" alt="" />
</div>
<div>
<img class="img14" src="~@/assets/img/home/img14.png" alt="" />
</div>
<div>
<img class="img15" src="~@/assets/img/home/img15.png" alt="" />
</div>
<div>
<img class="img16" src="~@/assets/img/home/img16.png" alt="" />
</div>
</div>
<div class="img17-parent">
<img class="img17" src="~@/assets/img/home/img17.png" alt="" />
</div>
<div class="bottom-img">
<img class="img18" src="~@/assets/img/home/img18.png" alt="" />
<img class="img19" src="~@/assets/img/home/img19.png" alt="" />
<img class="img20" src="~@/assets/img/home/img20.png" alt="" />
</div>
<div class="tab-bar"></div>
</div>
</div>
</template>
<script>
import StatusBar from "@/components/StatusBar";
import FormQuery from "./child_cpn/FormQuery";
export default {
components: {
StatusBar,
FormQuery,
},
data() {
return {
aaa: "",
};
},
created() {},
methods: {},
};
</script>
<style scoped src='./index.css'>
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment