@ -0,0 +1,91 @@ |
|||||
|
# Created by .ignore support plugin (hsz.mobi) |
||||
|
### Node template |
||||
|
# Logs |
||||
|
logs |
||||
|
*.log |
||||
|
npm-debug.log* |
||||
|
yarn-debug.log* |
||||
|
yarn-error.log* |
||||
|
|
||||
|
# Runtime data |
||||
|
pids |
||||
|
*.pid |
||||
|
*.seed |
||||
|
*.pid.lock |
||||
|
|
||||
|
# Directory for instrumented libs generated by jscoverage/JSCover |
||||
|
lib-cov |
||||
|
|
||||
|
# Coverage directory used by tools like istanbul |
||||
|
coverage |
||||
|
|
||||
|
# nyc test coverage |
||||
|
.nyc_output |
||||
|
|
||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) |
||||
|
.grunt |
||||
|
|
||||
|
# Bower dependency directory (https://bower.io/) |
||||
|
bower_components |
||||
|
|
||||
|
# node-waf configuration |
||||
|
.lock-wscript |
||||
|
|
||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html) |
||||
|
build/Release |
||||
|
|
||||
|
# Dependency directories |
||||
|
node_modules/ |
||||
|
jspm_packages/ |
||||
|
|
||||
|
# TypeScript v1 declaration files |
||||
|
typings/ |
||||
|
|
||||
|
# Optional npm cache directory |
||||
|
.npm |
||||
|
|
||||
|
# Optional eslint cache |
||||
|
.eslintcache |
||||
|
|
||||
|
# Optional REPL history |
||||
|
.node_repl_history |
||||
|
|
||||
|
# Output of 'npm pack' |
||||
|
*.tgz |
||||
|
|
||||
|
# Yarn Integrity file |
||||
|
.yarn-integrity |
||||
|
|
||||
|
# dotenv environment variables file |
||||
|
.env |
||||
|
|
||||
|
# parcel-bundler cache (https://parceljs.org/) |
||||
|
.cache |
||||
|
|
||||
|
# next.js build output |
||||
|
.next |
||||
|
|
||||
|
# nuxt.js build output |
||||
|
.nuxt |
||||
|
|
||||
|
# Nuxt generate |
||||
|
dist |
||||
|
|
||||
|
# vuepress build output |
||||
|
.vuepress/dist |
||||
|
|
||||
|
# Serverless directories |
||||
|
.serverless |
||||
|
|
||||
|
# IDE / Editor |
||||
|
.idea |
||||
|
.editorconfig |
||||
|
|
||||
|
# Service worker |
||||
|
sw.* |
||||
|
|
||||
|
# Mac OSX |
||||
|
.DS_Store |
||||
|
|
||||
|
# Vim swap files |
||||
|
*.swp |
@ -0,0 +1,86 @@ |
|||||
|
const path = require('path'); |
||||
|
module.exports = { |
||||
|
mode: 'universal', |
||||
|
/* |
||||
|
** Headers of the page |
||||
|
*/ |
||||
|
head: { |
||||
|
// process.env.npm_package_name ||
|
||||
|
title: 'Beer', |
||||
|
meta: [ |
||||
|
{charset: 'utf-8'}, |
||||
|
{name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no'}, |
||||
|
{hid: 'description', name: 'description', content: process.env.npm_package_description || ''} |
||||
|
], |
||||
|
link: [ |
||||
|
{rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'} |
||||
|
] |
||||
|
}, |
||||
|
env: { |
||||
|
baseUrl: process.env.BASE_URL || 'http://localhost:3000' |
||||
|
}, |
||||
|
/* |
||||
|
** Customize the progress-bar color |
||||
|
*/ |
||||
|
loading: {color: '#fff'}, |
||||
|
/* |
||||
|
** Global CSS |
||||
|
*/ |
||||
|
css: [ |
||||
|
'reset-css/reset.css', |
||||
|
], |
||||
|
/* |
||||
|
** Plugins to load before mounting the App |
||||
|
*/ |
||||
|
plugins: [ |
||||
|
'~/plugins/axios', |
||||
|
'~/plugins/global-components' |
||||
|
], |
||||
|
/* |
||||
|
** Nuxt.js dev-modules |
||||
|
*/ |
||||
|
devModules: [], |
||||
|
/* |
||||
|
** Nuxt.js modules |
||||
|
*/ |
||||
|
modules: [ |
||||
|
'@nuxtjs/style-resources', |
||||
|
// 使用bootstrap-vue
|
||||
|
// 'bootstrap-vue/nuxt',
|
||||
|
'@nuxtjs/axios' |
||||
|
], |
||||
|
//https://axios.nuxtjs.org/setup
|
||||
|
axios: { |
||||
|
// proxyHeaders: false
|
||||
|
retry: {retries: 3}, |
||||
|
proxy: true |
||||
|
}, |
||||
|
proxy: { |
||||
|
// 跟下面的冲突了
|
||||
|
// '/api/': 'http://api.example.com'
|
||||
|
}, |
||||
|
styleResources: { |
||||
|
// your settings here
|
||||
|
sass: [], |
||||
|
scss: ['./assets/style/_global.scss'], |
||||
|
less: [], |
||||
|
stylus: [] |
||||
|
}, |
||||
|
/* |
||||
|
** Build configuration |
||||
|
*/ |
||||
|
build: { |
||||
|
/* |
||||
|
** You can extend webpack config here |
||||
|
*/ |
||||
|
extend(config, ctx) { |
||||
|
config.resolve.alias['@pages'] = path.resolve(__dirname, 'pages'); |
||||
|
config.resolve.alias['@assets'] = path.resolve(__dirname, 'assets'); |
||||
|
config.resolve.alias['@components'] = path.resolve(__dirname, 'components'); |
||||
|
config.resolve.alias['@images'] = path.resolve(__dirname, 'assets', 'images'); |
||||
|
} |
||||
|
}, |
||||
|
serverMiddleware: [ |
||||
|
{path:'/api/auth', handler:'~/api/auth'} |
||||
|
] |
||||
|
} |
@ -0,0 +1,89 @@ |
|||||
|
const path = require('path'); |
||||
|
module.exports = { |
||||
|
mode: 'universal', |
||||
|
/* |
||||
|
** Headers of the page |
||||
|
*/ |
||||
|
head: { |
||||
|
// process.env.npm_package_name ||
|
||||
|
title: 'Beer', |
||||
|
meta: [ |
||||
|
{charset: 'utf-8'}, |
||||
|
{name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no'}, |
||||
|
{hid: 'description', name: 'description', content: process.env.npm_package_description || ''} |
||||
|
], |
||||
|
link: [ |
||||
|
{rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'} |
||||
|
] |
||||
|
}, |
||||
|
generate:{ |
||||
|
dir:'docs' |
||||
|
}, |
||||
|
env: { |
||||
|
baseUrl: process.env.BASE_URL || 'http://localhost:3000' |
||||
|
}, |
||||
|
/* |
||||
|
** Customize the progress-bar color |
||||
|
*/ |
||||
|
loading: {color: '#fff'}, |
||||
|
/* |
||||
|
** Global CSS |
||||
|
*/ |
||||
|
css: [ |
||||
|
'reset-css/reset.css', |
||||
|
], |
||||
|
/* |
||||
|
** Plugins to load before mounting the App |
||||
|
*/ |
||||
|
plugins: [ |
||||
|
'~/plugins/axios', |
||||
|
'~/plugins/global-components' |
||||
|
], |
||||
|
/* |
||||
|
** Nuxt.js dev-modules |
||||
|
*/ |
||||
|
devModules: [], |
||||
|
/* |
||||
|
** Nuxt.js modules |
||||
|
*/ |
||||
|
modules: [ |
||||
|
'@nuxtjs/style-resources', |
||||
|
// 使用bootstrap-vue
|
||||
|
// 'bootstrap-vue/nuxt',
|
||||
|
'@nuxtjs/axios' |
||||
|
], |
||||
|
//https://axios.nuxtjs.org/setup
|
||||
|
axios: { |
||||
|
// proxyHeaders: false
|
||||
|
retry: {retries: 3}, |
||||
|
proxy: true |
||||
|
}, |
||||
|
proxy: { |
||||
|
// 跟下面的冲突了
|
||||
|
// '/api/': 'http://api.example.com'
|
||||
|
}, |
||||
|
styleResources: { |
||||
|
// your settings here
|
||||
|
sass: [], |
||||
|
scss: ['./assets/style/_global.scss'], |
||||
|
less: [], |
||||
|
stylus: [] |
||||
|
}, |
||||
|
/* |
||||
|
** Build configuration |
||||
|
*/ |
||||
|
build: { |
||||
|
/* |
||||
|
** You can extend webpack config here |
||||
|
*/ |
||||
|
extend(config, ctx) { |
||||
|
config.resolve.alias['@pages'] = path.resolve(__dirname, 'pages'); |
||||
|
config.resolve.alias['@assets'] = path.resolve(__dirname, 'assets'); |
||||
|
config.resolve.alias['@components'] = path.resolve(__dirname, 'components'); |
||||
|
config.resolve.alias['@images'] = path.resolve(__dirname, 'assets', 'images'); |
||||
|
} |
||||
|
}, |
||||
|
serverMiddleware: [ |
||||
|
{path:'/api/auth', handler:'~/api/auth'} |
||||
|
] |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
# huaqian |
||||
|
|
||||
|
> My primo Nuxt.js project |
||||
|
|
||||
|
## Build Setup |
||||
|
|
||||
|
``` bash |
||||
|
# install dependencies |
||||
|
$ npm run install |
||||
|
|
||||
|
# serve with hot reload at localhost:3000 |
||||
|
$ npm run dev |
||||
|
|
||||
|
# build for production and launch server |
||||
|
$ npm run build |
||||
|
$ npm run start |
||||
|
|
||||
|
# generate static project |
||||
|
$ npm run generate |
||||
|
``` |
||||
|
|
||||
|
For detailed explanation on how things work, check out [Nuxt.js docs](https://nuxtjs.org). |
||||
|
|
||||
|
|
||||
|
1 |
||||
|
|
||||
|
2 |
||||
|
|
||||
|
3 |
@ -0,0 +1,13 @@ |
|||||
|
export default function (req,res,next) { |
||||
|
// req 是 Node.js http request 对象
|
||||
|
// console.log(req.ctx.body={code:200})
|
||||
|
// console.log(res)
|
||||
|
// ctx.body={
|
||||
|
// code:200
|
||||
|
// }
|
||||
|
//next是一个调用下一个中间件的函数
|
||||
|
// 如果您的中间件不是最终执行,请不要忘记在最后调用next!
|
||||
|
next() |
||||
|
} |
||||
|
|
||||
|
|
@ -0,0 +1,7 @@ |
|||||
|
# ASSETS |
||||
|
|
||||
|
**This directory is not required, you can delete it if you don't want to use it.** |
||||
|
|
||||
|
This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. |
||||
|
|
||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked). |
@ -0,0 +1,8 @@ |
|||||
|
|
||||
|
|
||||
|
@import "./common.scss"; |
||||
|
|
||||
|
html{ |
||||
|
width: 100vw; |
||||
|
height: 100vh; |
||||
|
} |
@ -0,0 +1,297 @@ |
|||||
|
// 清除浮动 |
||||
|
%clearfix { |
||||
|
|
||||
|
&:after, |
||||
|
&:before { |
||||
|
content: " "; |
||||
|
display: table; |
||||
|
} |
||||
|
|
||||
|
&:after { |
||||
|
clear: both; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 文字溢出省略,仅webkit支持多 |
||||
|
@mixin ellipsis($lines) { |
||||
|
@if ($lines==1) { |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
white-space: nowrap; |
||||
|
} |
||||
|
|
||||
|
@else { |
||||
|
display: -webkit-box; |
||||
|
-webkit-box-orient: vertical; |
||||
|
-webkit-line-clamp: $lines; |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
word-break: break-all; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
%ellipsis { |
||||
|
@include ellipsis(1); |
||||
|
} |
||||
|
|
||||
|
// 去掉滚动条 |
||||
|
%no-scrollbar { |
||||
|
&::-webkit-scrollbar { |
||||
|
display: none !important; |
||||
|
width: 0 !important; |
||||
|
height: 0 !important; |
||||
|
-webkit-appearance: none; |
||||
|
opacity: 0 !important; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 使用 @extend %no-scrollbar; |
||||
|
|
||||
|
// 一像素边框 |
||||
|
%_onepxElement { |
||||
|
content: ''; |
||||
|
position: absolute; |
||||
|
} |
||||
|
|
||||
|
%_onepxTopBottom { |
||||
|
@extend %_onepxElement; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
} |
||||
|
|
||||
|
%_onepxLeftRight { |
||||
|
@extend %_onepxElement; |
||||
|
top: 0; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
|
||||
|
@mixin setDprBorder($direction: tb) { |
||||
|
@for $i from 1 through 4 { |
||||
|
@media screen and (-webkit-min-device-pixel-ratio: $i) { |
||||
|
@if($direction==tb) { |
||||
|
transform: scaleY(1 / $i); |
||||
|
} |
||||
|
|
||||
|
@else if($direction==lr) { |
||||
|
transform: scaleX(1 / $i); |
||||
|
} |
||||
|
|
||||
|
@else if($direction==full) { |
||||
|
transform: scale(1 / $i); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/* |
||||
|
* 一像素边框 |
||||
|
* $direction: 边框方向,默认底边框 |
||||
|
* $style: 线条样式,默认solid |
||||
|
* $color: 边框颜色 |
||||
|
*/ |
||||
|
@mixin one-px-border($direction: bottom, $style: solid, $color: #e5e5e5) { |
||||
|
position: relative; |
||||
|
$border: 1px $style $color; |
||||
|
|
||||
|
@if ($direction==bottom) { |
||||
|
&:after { |
||||
|
@extend %_onepxTopBottom; |
||||
|
@include setDprBorder(tb); |
||||
|
border-top: $border; |
||||
|
bottom: 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@else if ($direction==top) { |
||||
|
&:before { |
||||
|
@extend %_onepxTopBottom; |
||||
|
@include setDprBorder(tb); |
||||
|
border-top: $border; |
||||
|
top: 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@else if ($direction==left) { |
||||
|
&:before { |
||||
|
@extend %_onepxLeftRight; |
||||
|
@include setDprBorder(lr); |
||||
|
border-left: $border; |
||||
|
left: 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@else if ($direction==right) { |
||||
|
&:after { |
||||
|
@extend %_onepxLeftRight; |
||||
|
@include setDprBorder(lr); |
||||
|
border-left: $border; |
||||
|
right: 0; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 默认下边框 |
||||
|
%one-px-border { |
||||
|
@include one-px-border(); |
||||
|
} |
||||
|
|
||||
|
// 四边一像素边框 |
||||
|
@mixin full-px-border($color: #e5e5e5, $radius: 0, $zIndex: -1) { |
||||
|
position: relative; |
||||
|
z-index: 1; |
||||
|
|
||||
|
&:before { |
||||
|
content: ''; |
||||
|
position: absolute; |
||||
|
z-index: $zIndex; |
||||
|
border: 1px solid $color; |
||||
|
width: 200%; |
||||
|
height: 200%; |
||||
|
border-radius: inherit; |
||||
|
transform: scale(.5); |
||||
|
transform-origin: top left; |
||||
|
border-radius: $radius * 2; |
||||
|
left: 0; |
||||
|
top: 0 |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
%full-px-border { |
||||
|
@include full-px-border(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 去除单位并返回数值 |
||||
|
@function strip-units($number) { |
||||
|
@return $number / ($number * 0 + 1); |
||||
|
} |
||||
|
|
||||
|
// px转rem |
||||
|
@mixin px2rem($attr, $num, $base: 37.5) { |
||||
|
$list: (); //存储所有转换后的值 |
||||
|
|
||||
|
// 遍历所有值并转换为rem单位 |
||||
|
@for $i from 1 through length($num) { |
||||
|
// 计算单个rem值 |
||||
|
$value: strip-units(nth($num, $i)) / $base * 1rem; |
||||
|
// 添加到列表中 |
||||
|
$list: append($list, $value); |
||||
|
} |
||||
|
|
||||
|
// 设置属性值 |
||||
|
#{$attr}:$list; |
||||
|
} |
||||
|
|
||||
|
@function px2rem($num, $base: 37.5) { |
||||
|
@return strip-units($num) / $base * 1rem; |
||||
|
} |
||||
|
|
||||
|
// 居中一个元素 |
||||
|
@mixin center($position) { |
||||
|
position: absolute; |
||||
|
|
||||
|
@if $position=='vertical' { |
||||
|
top: 50%; |
||||
|
transform: translateY(-50%); |
||||
|
} |
||||
|
|
||||
|
@else if $position=='horizontal' { |
||||
|
left: 50%; |
||||
|
transform: translateX(-50%); |
||||
|
} |
||||
|
|
||||
|
@else if $position=='both' { |
||||
|
top: 50%; |
||||
|
left: 50%; |
||||
|
transform: translate(-50%, -50%); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 该函数可以用来做各种方向的背景渐变, |
||||
|
@mixin background-gradient($start-color, $end-color, $orientation) { |
||||
|
background: $start-color; |
||||
|
|
||||
|
@if $orientation=='vertical' { |
||||
|
background: linear-gradient(to bottom, $start-color, $end-color); |
||||
|
} |
||||
|
|
||||
|
@else if $orientation=='horizontal' { |
||||
|
background: linear-gradient(to right, $start-color, $end-color); |
||||
|
} |
||||
|
|
||||
|
@else { |
||||
|
background: radial-gradient(ellipse at center, $start-color, $end-color); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// |
||||
|
@mixin triangle($direction: down, $size: 5px, $color: #F96001) { |
||||
|
width: 0px; |
||||
|
height: 0px; |
||||
|
|
||||
|
@if ($direction==left) { |
||||
|
border-top: $size solid transparent; |
||||
|
border-bottom: $size solid transparent; |
||||
|
border-right: $size solid $color; |
||||
|
} |
||||
|
|
||||
|
@else if ($direction==right) { |
||||
|
border-top: $size solid transparent; |
||||
|
border-bottom: $size solid transparent; |
||||
|
border-left: $size solid $color; |
||||
|
} |
||||
|
|
||||
|
@else if ($direction==down) { |
||||
|
border-left: $size solid transparent; |
||||
|
border-right: $size solid transparent; |
||||
|
border-top: $size solid $color; |
||||
|
} |
||||
|
|
||||
|
@else { |
||||
|
border-left: $size solid transparent; |
||||
|
border-right: $size solid transparent; |
||||
|
border-bottom: $size solid $color; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 媒体查询 |
||||
|
|
||||
|
$width-small: 400px; |
||||
|
$width-medium: 760px; |
||||
|
$width-large: 1200px; |
||||
|
|
||||
|
@mixin responsive($width) { |
||||
|
@if $width==wide-screens { |
||||
|
@media only screen and (max-width: $width-large) { |
||||
|
@content; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@else if $width==medium-screens { |
||||
|
@media only screen and (max-width: $width-medium) { |
||||
|
@content; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@else if $width==small-screens { |
||||
|
@media only screen and (max-width: $width-small) { |
||||
|
@content; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// @include responsive(wide-screens) { |
||||
|
// width: 80%; |
||||
|
// } |
||||
|
|
||||
|
// @include responsive(medium-screens) { |
||||
|
// width: 50%; |
||||
|
// font-size: 14px; |
||||
|
// } |
||||
|
|
||||
|
// @include responsive(small-screens) { |
||||
|
// float: none; |
||||
|
// width: 100%; |
||||
|
// font-size: 12px; |
||||
|
// } |
@ -0,0 +1,7 @@ |
|||||
|
# COMPONENTS |
||||
|
|
||||
|
**This directory is not required, you can delete it if you don't want to use it.** |
||||
|
|
||||
|
The components directory contains your Vue.js Components. |
||||
|
|
||||
|
_Nuxt.js doesn't supercharge these components._ |
@ -0,0 +1,5 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
dsads |
||||
|
</div> |
||||
|
</template> |
@ -0,0 +1,9 @@ |
|||||
|
<!doctype html> |
||||
|
<html data-n-head=""> |
||||
|
<head data-n-head=""> |
||||
|
<title data-n-head="true">Beer</title><meta data-n-head="true" charset="utf-8"><meta data-n-head="true" name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta data-n-head="true" data-hid="description" name="description" content="My primo Nuxt.js project"><link data-n-head="true" rel="icon" type="image/x-icon" href="/favicon.ico"><link rel="preload" href="/_nuxt/70a23dfee6887fa06070.js" as="script"><link rel="preload" href="/_nuxt/c3fddfa169fb3fbb257c.js" as="script"><link rel="preload" href="/_nuxt/3aba3795865a3a6df722.js" as="script"><link rel="preload" href="/_nuxt/abe886ed6f5098a6ec11.js" as="script"> |
||||
|
</head> |
||||
|
<body data-n-head=""> |
||||
|
<div id="__nuxt"><style>#nuxt-loading{visibility:hidden;opacity:0;position:absolute;left:0;right:0;top:0;bottom:0;display:flex;justify-content:center;align-items:center;flex-direction:column;animation:nuxtLoadingIn 10s ease;-webkit-animation:nuxtLoadingIn 10s ease;animation-fill-mode:forwards;overflow:hidden}@keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}@-webkit-keyframes nuxtLoadingIn{0%{visibility:hidden;opacity:0}20%{visibility:visible;opacity:0}100%{visibility:visible;opacity:1}}#nuxt-loading>div,#nuxt-loading>div:after{border-radius:50%;width:5rem;height:5rem}#nuxt-loading>div{font-size:10px;position:relative;text-indent:-9999em;border:.5rem solid #f5f5f5;border-left:.5rem solid #fff;-webkit-transform:translateZ(0);-ms-transform:translateZ(0);transform:translateZ(0);-webkit-animation:nuxtLoading 1.1s infinite linear;animation:nuxtLoading 1.1s infinite linear}#nuxt-loading.error>div{border-left:.5rem solid #ff4500;animation-duration:5s}@-webkit-keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes nuxtLoading{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}</style><script>window.addEventListener("error",function(){var e=document.getElementById("nuxt-loading");e&&(e.className+=" error")})</script><div id="nuxt-loading" aria-live="polite" role="status"><div>Loading...</div></div></div> |
||||
|
<script type="text/javascript" src="/_nuxt/70a23dfee6887fa06070.js"></script><script type="text/javascript" src="/_nuxt/c3fddfa169fb3fbb257c.js"></script><script type="text/javascript" src="/_nuxt/3aba3795865a3a6df722.js"></script><script type="text/javascript" src="/_nuxt/abe886ed6f5098a6ec11.js"></script></body> |
||||
|
</html> |
@ -0,0 +1,11 @@ |
|||||
|
# STATIC |
||||
|
|
||||
|
**This directory is not required, you can delete it if you don't want to use it.** |
||||
|
|
||||
|
This directory contains your static files. |
||||
|
Each file inside this directory is mapped to `/`. |
||||
|
Thus you'd want to delete this README.md before deploying to production. |
||||
|
|
||||
|
Example: `/static/robots.txt` is mapped as `/robots.txt`. |
||||
|
|
||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). |
@ -0,0 +1 @@ |
|||||
|
!function(e){function r(data){for(var r,n,l=data[0],f=data[1],d=data[2],i=0,h=[];i<l.length;i++)n=l[i],Object.prototype.hasOwnProperty.call(o,n)&&o[n]&&h.push(o[n][0]),o[n]=0;for(r in f)Object.prototype.hasOwnProperty.call(f,r)&&(e[r]=f[r]);for(v&&v(data);h.length;)h.shift()();return c.push.apply(c,d||[]),t()}function t(){for(var e,i=0;i<c.length;i++){for(var r=c[i],t=!0,n=1;n<r.length;n++){var f=r[n];0!==o[f]&&(t=!1)}t&&(c.splice(i--,1),e=l(l.s=r[0]))}return e}var n={},o={3:0},c=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise(function(r,n){t=o[e]=[r,n]});r.push(t[2]=n);var c,script=document.createElement("script");script.charset="utf-8",script.timeout=120,l.nc&&script.setAttribute("nonce",l.nc),script.src=function(e){return l.p+""+{2:"e69fb52ab975dddac5e5"}[e]+".js"}(e);var f=new Error;c=function(r){script.onerror=script.onload=null,clearTimeout(d);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),c=r&&r.target&&r.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+c+")",f.name="ChunkLoadError",f.type=n,f.request=c,t[1](f)}o[e]=void 0}};var d=setTimeout(function(){c({type:"timeout",target:script})},12e4);script.onerror=script.onload=c,document.head.appendChild(script)}return Promise.all(r)},l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(object,e){return Object.prototype.hasOwnProperty.call(object,e)},l.p="/_nuxt/",l.oe=function(e){throw console.error(e),e};var f=window.webpackJsonp=window.webpackJsonp||[],d=f.push.bind(f);f.push=r,f=f.slice();for(var i=0;i<f.length;i++)r(f[i]);var v=d;t()}([]); |
@ -0,0 +1,42 @@ |
|||||
|
/*! |
||||
|
* Vue.js v2.6.10 |
||||
|
* (c) 2014-2019 Evan You |
||||
|
* Released under the MIT License. |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* vue-router v3.1.2 |
||||
|
* (c) 2019 Evan You |
||||
|
* @license MIT |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* vuex v3.1.1 |
||||
|
* (c) 2019 Evan You |
||||
|
* @license MIT |
||||
|
*/ |
||||
|
|
||||
|
/** |
||||
|
* vue-meta v1.6.0 |
||||
|
* (c) 2019 Declan de Wet & Sébastien Chopin (@Atinux) |
||||
|
* @license MIT |
||||
|
*/ |
||||
|
|
||||
|
/* |
||||
|
object-assign |
||||
|
(c) Sindre Sorhus |
||||
|
@license MIT |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* Determine if an object is a Buffer |
||||
|
* |
||||
|
* @author Feross Aboukhadijeh <https://feross.org> |
||||
|
* @license MIT |
||||
|
*/ |
||||
|
|
||||
|
/*! |
||||
|
* vue-no-ssr v1.1.1 |
||||
|
* (c) 2018-present egoist <0x142857@gmail.com> |
||||
|
* Released under the MIT License. |
||||
|
*/ |
@ -0,0 +1 @@ |
|||||
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{215:function(e,t,n){"use strict";n.r(t);n(37);var r,c,o=n(5),f={asyncData:(c=Object(o.a)(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.$axios,e.abrupt("return",{});case 2:case"end":return e.stop()}},e)})),function(e){return c.apply(this,arguments)}),fetch:(r=Object(o.a)(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.store,t.params,t.$axios;case 1:case"end":return e.stop()}},e)})),function(e){return r.apply(this,arguments)}),mounted:function(){},data:function(){return{}},methods:{}},l=n(16),component=Object(l.a)(f,function(){var e=this.$createElement;return(this._self._c||e)("div")},[],!1,null,null,null);t.default=component.exports}}]); |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 906 B |
After Width: | Height: | Size: 751 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 258 B |
@ -0,0 +1,9 @@ |
|||||
|
<!doctype html> |
||||
|
<html data-n-head-ssr data-n-head=""> |
||||
|
<head data-n-head=""> |
||||
|
<title data-n-head="true">Beer</title><meta data-n-head="true" charset="utf-8"><meta data-n-head="true" name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta data-n-head="true" data-hid="description" name="description" content="My primo Nuxt.js project"><link data-n-head="true" rel="icon" type="image/x-icon" href="/favicon.ico"><link rel="preload" href="/_nuxt/70a23dfee6887fa06070.js" as="script"><link rel="preload" href="/_nuxt/c3fddfa169fb3fbb257c.js" as="script"><link rel="preload" href="/_nuxt/3aba3795865a3a6df722.js" as="script"><link rel="preload" href="/_nuxt/abe886ed6f5098a6ec11.js" as="script"><link rel="preload" href="/_nuxt/e69fb52ab975dddac5e5.js" as="script"><style data-vue-ssr-id="290f013b:0 17cfdfa9:0 1112905c:0">a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,main,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section{display:block}[hidden]{display:none}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}table{border-collapse:collapse;border-spacing:0}.nuxt-progress{position:fixed;top:0;left:0;right:0;height:2px;width:0;opacity:1;transition:width .1s,opacity .4s;background-color:#fff;z-index:999999}.nuxt-progress.nuxt-progress-notransition{transition:none}.nuxt-progress-failed{background-color:red}html[data-v-e0d65c42]{width:100vw;height:100vh}.default.layout[data-v-e0d65c42]{background:#f5f5d5;position:fixed;left:0;right:0;bottom:0;top:0}</style> |
||||
|
</head> |
||||
|
<body data-n-head=""> |
||||
|
<div data-server-rendered="true" id="__nuxt"><!----><div id="__layout"><div class="default layout" data-v-e0d65c42><div data-v-e0d65c42></div></div></div></div><script>window.__NUXT__={layout:"default",data:[{}],error:null,state:{user:{},todos:{list:[],ip:""}},serverRendered:!0}</script><script src="/_nuxt/70a23dfee6887fa06070.js" defer></script><script src="/_nuxt/e69fb52ab975dddac5e5.js" defer></script><script src="/_nuxt/c3fddfa169fb3fbb257c.js" defer></script><script src="/_nuxt/3aba3795865a3a6df722.js" defer></script><script src="/_nuxt/abe886ed6f5098a6ec11.js" defer></script> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,77 @@ |
|||||
|
(function (designWidth, maxWidth) { |
||||
|
var doc = document, |
||||
|
win = window; |
||||
|
var docEl = doc.documentElement; |
||||
|
var metaEl, |
||||
|
metaElCon; |
||||
|
var styleText, |
||||
|
remStyle = document.createElement("style"); |
||||
|
var tid; |
||||
|
|
||||
|
function refreshRem() { |
||||
|
// var width = parseInt(window.screen.width); // uc有bug
|
||||
|
var width = docEl.getBoundingClientRect().width; |
||||
|
if (!maxWidth) { |
||||
|
maxWidth = 540; |
||||
|
}; |
||||
|
if (width > maxWidth) { // 淘宝做法:限制在540的屏幕下,这样100%就跟10rem不一样了
|
||||
|
width = maxWidth; |
||||
|
} |
||||
|
var rem = width * 100 / designWidth; |
||||
|
// var rem = width / 10; // 如果要兼容vw的话分成10份 淘宝做法
|
||||
|
//docEl.style.fontSize = rem + "px"; //旧的做法,在uc浏览器下面会有切换横竖屏时定义了font-size的标签不起作用的bug
|
||||
|
remStyle.innerHTML = 'html{font-size:' + rem + 'px;}'; |
||||
|
} |
||||
|
|
||||
|
// 设置 viewport ,有的话修改 没有的话设置
|
||||
|
metaEl = doc.querySelector('meta[name="viewport"]'); |
||||
|
// 20171219修改:增加 viewport-fit=cover ,用于适配iphoneX
|
||||
|
metaElCon = "width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable=no,viewport-fit=cover"; |
||||
|
if (metaEl) { |
||||
|
metaEl.setAttribute("content", metaElCon); |
||||
|
} else { |
||||
|
metaEl = doc.createElement("meta"); |
||||
|
metaEl.setAttribute("name", "viewport"); |
||||
|
metaEl.setAttribute("content", metaElCon); |
||||
|
if (docEl.firstElementChild) { |
||||
|
docEl.firstElementChild.appendChild(metaEl); |
||||
|
} else { |
||||
|
var wrap = doc.createElement("div"); |
||||
|
wrap.appendChild(metaEl); |
||||
|
doc.write(wrap.innerHTML); |
||||
|
wrap = null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
|
||||
|
refreshRem(); |
||||
|
|
||||
|
if (docEl.firstElementChild) { |
||||
|
docEl.firstElementChild.appendChild(remStyle); |
||||
|
} else { |
||||
|
var wrap = doc.createElement("div"); |
||||
|
wrap.appendChild(remStyle); |
||||
|
doc.write(wrap.innerHTML); |
||||
|
wrap = null; |
||||
|
} |
||||
|
|
||||
|
win.addEventListener("resize", function () { |
||||
|
clearTimeout(tid); //防止执行两次
|
||||
|
tid = setTimeout(refreshRem, 300); |
||||
|
}, false); |
||||
|
|
||||
|
win.addEventListener("pageshow", function (e) { |
||||
|
if (e.persisted) { // 浏览器后退的时候重新计算
|
||||
|
clearTimeout(tid); |
||||
|
tid = setTimeout(refreshRem, 300); |
||||
|
} |
||||
|
}, false); |
||||
|
|
||||
|
if (doc.readyState === "complete") { |
||||
|
doc.body.style.fontSize = "16px"; |
||||
|
} else { |
||||
|
doc.addEventListener("DOMContentLoaded", function (e) { |
||||
|
doc.body.style.fontSize = "16px"; |
||||
|
}, false); |
||||
|
} |
||||
|
})(750, 750); |
@ -0,0 +1,7 @@ |
|||||
|
# LAYOUTS |
||||
|
|
||||
|
**This directory is not required, you can delete it if you don't want to use it.** |
||||
|
|
||||
|
This directory contains your Application Layouts. |
||||
|
|
||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). |
@ -0,0 +1,20 @@ |
|||||
|
<template> |
||||
|
<div class="default layout"> |
||||
|
<nuxt /> |
||||
|
</div> |
||||
|
</template> |
||||
|
<script> |
||||
|
export default { |
||||
|
components: {} |
||||
|
}; |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.default.layout { |
||||
|
background: #f5f5d5; |
||||
|
position: fixed; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
bottom: 0; |
||||
|
top: 0; |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,8 @@ |
|||||
|
# MIDDLEWARE |
||||
|
|
||||
|
**This directory is not required, you can delete it if you don't want to use it.** |
||||
|
|
||||
|
This directory contains your application middleware. |
||||
|
Middleware let you define custom functions that can be run before rendering either a page or a group of pages. |
||||
|
|
||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). |
@ -0,0 +1,6 @@ |
|||||
|
export default function ({ store, redirect }) { |
||||
|
// console.log(store.state.user)
|
||||
|
// if (JSON.stringify(store.getters.user)=='{}') {
|
||||
|
// return redirect('/login')
|
||||
|
// }
|
||||
|
} |
@ -0,0 +1,89 @@ |
|||||
|
const path = require('path'); |
||||
|
module.exports = { |
||||
|
mode: 'universal', |
||||
|
/* |
||||
|
** Headers of the page |
||||
|
*/ |
||||
|
head: { |
||||
|
// process.env.npm_package_name ||
|
||||
|
title: 'Beer', |
||||
|
meta: [ |
||||
|
{charset: 'utf-8'}, |
||||
|
{name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no'}, |
||||
|
{hid: 'description', name: 'description', content: process.env.npm_package_description || ''} |
||||
|
], |
||||
|
link: [ |
||||
|
{rel: 'icon', type: 'image/x-icon', href: '/favicon.ico'} |
||||
|
] |
||||
|
}, |
||||
|
generate:{ |
||||
|
dir:'docs' |
||||
|
}, |
||||
|
env: { |
||||
|
baseUrl: process.env.BASE_URL || 'http://localhost:3000' |
||||
|
}, |
||||
|
/* |
||||
|
** Customize the progress-bar color |
||||
|
*/ |
||||
|
loading: {color: '#fff'}, |
||||
|
/* |
||||
|
** Global CSS |
||||
|
*/ |
||||
|
css: [ |
||||
|
'reset-css/reset.css', |
||||
|
], |
||||
|
/* |
||||
|
** Plugins to load before mounting the App |
||||
|
*/ |
||||
|
plugins: [ |
||||
|
'~/plugins/axios', |
||||
|
'~/plugins/global-components' |
||||
|
], |
||||
|
/* |
||||
|
** Nuxt.js dev-modules |
||||
|
*/ |
||||
|
devModules: [], |
||||
|
/* |
||||
|
** Nuxt.js modules |
||||
|
*/ |
||||
|
modules: [ |
||||
|
'@nuxtjs/style-resources', |
||||
|
// 使用bootstrap-vue
|
||||
|
// 'bootstrap-vue/nuxt',
|
||||
|
'@nuxtjs/axios' |
||||
|
], |
||||
|
//https://axios.nuxtjs.org/setup
|
||||
|
axios: { |
||||
|
// proxyHeaders: false
|
||||
|
retry: {retries: 3}, |
||||
|
proxy: true |
||||
|
}, |
||||
|
proxy: { |
||||
|
// 跟下面的冲突了
|
||||
|
// '/api/': 'http://api.example.com'
|
||||
|
}, |
||||
|
styleResources: { |
||||
|
// your settings here
|
||||
|
sass: [], |
||||
|
scss: ['./assets/style/_global.scss'], |
||||
|
less: [], |
||||
|
stylus: [] |
||||
|
}, |
||||
|
/* |
||||
|
** Build configuration |
||||
|
*/ |
||||
|
build: { |
||||
|
/* |
||||
|
** You can extend webpack config here |
||||
|
*/ |
||||
|
extend(config, ctx) { |
||||
|
config.resolve.alias['@pages'] = path.resolve(__dirname, 'pages'); |
||||
|
config.resolve.alias['@assets'] = path.resolve(__dirname, 'assets'); |
||||
|
config.resolve.alias['@components'] = path.resolve(__dirname, 'components'); |
||||
|
config.resolve.alias['@images'] = path.resolve(__dirname, 'assets', 'images'); |
||||
|
} |
||||
|
}, |
||||
|
serverMiddleware: [ |
||||
|
{path:'/api/auth', handler:'~/api/auth'} |
||||
|
] |
||||
|
} |
@ -0,0 +1,43 @@ |
|||||
|
{ |
||||
|
"name": "huaqian", |
||||
|
"version": "1.0.0", |
||||
|
"description": "My primo Nuxt.js project", |
||||
|
"author": "1549469775", |
||||
|
"private": true, |
||||
|
"scripts": { |
||||
|
"dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server", |
||||
|
"build": "nuxt build", |
||||
|
"start": "cross-env NODE_ENV=production node server/index.js", |
||||
|
"generate": "nuxt generate" |
||||
|
}, |
||||
|
"dependencies": { |
||||
|
"@nuxtjs/axios": "^5.6.0", |
||||
|
"@nuxtjs/style-resources": "^1.0.0", |
||||
|
"autoprefixer": "^9.6.1", |
||||
|
"bootstrap-vue": "^2.0.0-rc.27", |
||||
|
"cross-env": "^5.2.0", |
||||
|
"jquery": "^3.4.1", |
||||
|
"koa": "^2.6.2", |
||||
|
"koa-router": "^7.4.0", |
||||
|
"koa-session": "^5.12.3", |
||||
|
"localforage": "^1.7.3", |
||||
|
"lodash": "^4.17.15", |
||||
|
"node-sass": "^4.12.0", |
||||
|
"nuxt": "^2.0.0", |
||||
|
"postcss": "^7.0.17", |
||||
|
"postcss-loader": "^3.0.0", |
||||
|
"reset-css": "^4.0.1", |
||||
|
"sass-loader": "^7.2.0", |
||||
|
"sass-resources-loader": "^2.0.1", |
||||
|
"vuex-persistedstate": "^2.5.4" |
||||
|
}, |
||||
|
"devDependencies": { |
||||
|
"nodemon": "^1.18.9" |
||||
|
}, |
||||
|
"config": { |
||||
|
"nuxt": { |
||||
|
"host": "0.0.0.0", |
||||
|
"port": "5000" |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
# PAGES |
||||
|
|
||||
|
This directory contains your Application Views and Routes. |
||||
|
The framework reads all the `*.vue` files inside this directory and creates the router of your application. |
||||
|
|
||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing). |
@ -0,0 +1,31 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
|
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
async asyncData({ $axios }) { |
||||
|
return { } |
||||
|
}, |
||||
|
async fetch ({ store, params,$axios }) { |
||||
|
|
||||
|
}, |
||||
|
mounted(){ |
||||
|
|
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang='scss'> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,10 @@ |
|||||
|
# PLUGINS |
||||
|
|
||||
|
**This directory is not required, you can delete it if you don't want to use it.** |
||||
|
|
||||
|
This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. |
||||
|
|
||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). |
||||
|
|
||||
|
|
||||
|
用于使用插件的地方,例如vue-swiper |
@ -0,0 +1,25 @@ |
|||||
|
// onRequest(config)
|
||||
|
// onResponse(response)
|
||||
|
// onError(err)
|
||||
|
// onRequestError(err)
|
||||
|
// onResponseError(err)
|
||||
|
|
||||
|
export default function ({ $axios,store, redirect }) { |
||||
|
// store.commit('user/setToken','dasdsad')
|
||||
|
let token = store.state.user.token; |
||||
|
|
||||
|
$axios.setToken(token, 'Bearer') |
||||
|
|
||||
|
$axios.setHeader('Content-Type', 'application/json') |
||||
|
|
||||
|
$axios.onRequest(config => { |
||||
|
console.log('Making request to ' + config.url) |
||||
|
}) |
||||
|
|
||||
|
$axios.onError(error => { |
||||
|
const code = parseInt(error.response && error.response.status) |
||||
|
if (code === 400) { |
||||
|
redirect('/400') |
||||
|
} |
||||
|
}) |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
// 引入vue 及 lodash
|
||||
|
import Vue from 'vue' |
||||
|
import upperFirst from 'lodash/upperFirst' // 首字线大写
|
||||
|
import camelCase from 'lodash/camelCase' // 驼峰命名大法
|
||||
|
|
||||
|
// 把 /component/base/ 下的所有 vue 组件 require 进来
|
||||
|
// path: 要引入的组件所在相对路径(相对于当前文件)
|
||||
|
// deep: 是否检索子文件夹
|
||||
|
// matchFile: 匹配的文件名称
|
||||
|
// require.context(path, deep, matchFile)
|
||||
|
const requireComponent = require.context('../components/base/', false, /_base-[\w-]+\.vue$/) |
||||
|
|
||||
|
// 遍历 require 进来的组件并注册
|
||||
|
requireComponent.keys().forEach((fileName) => { |
||||
|
const componentConfig = requireComponent(fileName) |
||||
|
const componentName = upperFirst( camelCase( fileName.replace(/^\.\/_/, '').replace(/\.\w+$/, '') ) ) |
||||
|
// 全局注册组件
|
||||
|
Vue.component(componentName, componentConfig.default || componentConfig) |
||||
|
}) |
@ -0,0 +1,42 @@ |
|||||
|
const Koa = require('koa') |
||||
|
const consola = require('consola') |
||||
|
const { Nuxt, Builder } = require('nuxt') |
||||
|
|
||||
|
const app = new Koa() |
||||
|
|
||||
|
// Import and Set Nuxt.js options
|
||||
|
const config = require('../nuxt.config.js') |
||||
|
config.dev = app.env !== 'production' |
||||
|
|
||||
|
async function start () { |
||||
|
// Instantiate nuxt.js
|
||||
|
const nuxt = new Nuxt(config) |
||||
|
|
||||
|
const { |
||||
|
host = process.env.HOST || '127.0.0.1', |
||||
|
port = process.env.PORT || 3000 |
||||
|
} = nuxt.options.server |
||||
|
|
||||
|
// Build in development
|
||||
|
if (config.dev) { |
||||
|
const builder = new Builder(nuxt) |
||||
|
await builder.build() |
||||
|
} else { |
||||
|
await nuxt.ready() |
||||
|
} |
||||
|
|
||||
|
app.use(async (ctx,next) => { |
||||
|
ctx.status = 200 |
||||
|
ctx.respond = false // Bypass Koa's built-in response handling
|
||||
|
ctx.req.ctx = ctx // This might be useful later on, e.g. in nuxtServerInit or with nuxt-stash
|
||||
|
nuxt.render(ctx.req, ctx.res) |
||||
|
}) |
||||
|
|
||||
|
app.listen(port, host) |
||||
|
consola.ready({ |
||||
|
message: `Server listening on http://${host}:${port}`, |
||||
|
badge: true |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
start() |
@ -0,0 +1,11 @@ |
|||||
|
# STATIC |
||||
|
|
||||
|
**This directory is not required, you can delete it if you don't want to use it.** |
||||
|
|
||||
|
This directory contains your static files. |
||||
|
Each file inside this directory is mapped to `/`. |
||||
|
Thus you'd want to delete this README.md before deploying to production. |
||||
|
|
||||
|
Example: `/static/robots.txt` is mapped as `/robots.txt`. |
||||
|
|
||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 906 B |
After Width: | Height: | Size: 751 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 258 B |
@ -0,0 +1,77 @@ |
|||||
|
(function (designWidth, maxWidth) { |
||||
|
var doc = document, |
||||
|
win = window; |
||||
|
var docEl = doc.documentElement; |
||||
|
var metaEl, |
||||
|
metaElCon; |
||||
|
var styleText, |
||||
|
remStyle = document.createElement("style"); |
||||
|
var tid; |
||||
|
|
||||
|
function refreshRem() { |
||||
|
// var width = parseInt(window.screen.width); // uc有bug
|
||||
|
var width = docEl.getBoundingClientRect().width; |
||||
|
if (!maxWidth) { |
||||
|
maxWidth = 540; |
||||
|
}; |
||||
|
if (width > maxWidth) { // 淘宝做法:限制在540的屏幕下,这样100%就跟10rem不一样了
|
||||
|
width = maxWidth; |
||||
|
} |
||||
|
var rem = width * 100 / designWidth; |
||||
|
// var rem = width / 10; // 如果要兼容vw的话分成10份 淘宝做法
|
||||
|
//docEl.style.fontSize = rem + "px"; //旧的做法,在uc浏览器下面会有切换横竖屏时定义了font-size的标签不起作用的bug
|
||||
|
remStyle.innerHTML = 'html{font-size:' + rem + 'px;}'; |
||||
|
} |
||||
|
|
||||
|
// 设置 viewport ,有的话修改 没有的话设置
|
||||
|
metaEl = doc.querySelector('meta[name="viewport"]'); |
||||
|
// 20171219修改:增加 viewport-fit=cover ,用于适配iphoneX
|
||||
|
metaElCon = "width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable=no,viewport-fit=cover"; |
||||
|
if (metaEl) { |
||||
|
metaEl.setAttribute("content", metaElCon); |
||||
|
} else { |
||||
|
metaEl = doc.createElement("meta"); |
||||
|
metaEl.setAttribute("name", "viewport"); |
||||
|
metaEl.setAttribute("content", metaElCon); |
||||
|
if (docEl.firstElementChild) { |
||||
|
docEl.firstElementChild.appendChild(metaEl); |
||||
|
} else { |
||||
|
var wrap = doc.createElement("div"); |
||||
|
wrap.appendChild(metaEl); |
||||
|
doc.write(wrap.innerHTML); |
||||
|
wrap = null; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
|
||||
|
refreshRem(); |
||||
|
|
||||
|
if (docEl.firstElementChild) { |
||||
|
docEl.firstElementChild.appendChild(remStyle); |
||||
|
} else { |
||||
|
var wrap = doc.createElement("div"); |
||||
|
wrap.appendChild(remStyle); |
||||
|
doc.write(wrap.innerHTML); |
||||
|
wrap = null; |
||||
|
} |
||||
|
|
||||
|
win.addEventListener("resize", function () { |
||||
|
clearTimeout(tid); //防止执行两次
|
||||
|
tid = setTimeout(refreshRem, 300); |
||||
|
}, false); |
||||
|
|
||||
|
win.addEventListener("pageshow", function (e) { |
||||
|
if (e.persisted) { // 浏览器后退的时候重新计算
|
||||
|
clearTimeout(tid); |
||||
|
tid = setTimeout(refreshRem, 300); |
||||
|
} |
||||
|
}, false); |
||||
|
|
||||
|
if (doc.readyState === "complete") { |
||||
|
doc.body.style.fontSize = "16px"; |
||||
|
} else { |
||||
|
doc.addEventListener("DOMContentLoaded", function (e) { |
||||
|
doc.body.style.fontSize = "16px"; |
||||
|
}, false); |
||||
|
} |
||||
|
})(750, 750); |
@ -0,0 +1,10 @@ |
|||||
|
# STORE |
||||
|
|
||||
|
**This directory is not required, you can delete it if you don't want to use it.** |
||||
|
|
||||
|
This directory contains your Vuex Store files. |
||||
|
Vuex Store option is implemented in the Nuxt.js framework. |
||||
|
|
||||
|
Creating a file in this directory automatically activates the option in the framework. |
||||
|
|
||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store). |
@ -0,0 +1,37 @@ |
|||||
|
import createPersistedState from 'vuex-persistedstate' |
||||
|
// import localforage from 'localforage'
|
||||
|
|
||||
|
// export const plugins = [ createPersistedState({
|
||||
|
// key:'fuckme',
|
||||
|
// storage:localforage,
|
||||
|
// paths: ['user.token'] //,'room.room'
|
||||
|
// }) ]
|
||||
|
|
||||
|
export const state = () => ({ |
||||
|
user: {} |
||||
|
}) |
||||
|
|
||||
|
export const getters = { |
||||
|
user(state){ |
||||
|
return state.user; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export const mutations = { |
||||
|
SET_USER (state,user) { |
||||
|
state.user=user; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export const actions = { |
||||
|
nuxtServerInit({ commit }, { req, res }) { |
||||
|
// if (req.session && req.session.user) {
|
||||
|
// const { username, password } = req.session.user
|
||||
|
// const user = {
|
||||
|
// username,
|
||||
|
// password
|
||||
|
// }
|
||||
|
// commit('SET_USER', user)
|
||||
|
// }
|
||||
|
}, |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
export const state = () => ({ |
||||
|
list: [], |
||||
|
ip:'' |
||||
|
}) |
||||
|
|
||||
|
export const mutations = { |
||||
|
add(state, text) { |
||||
|
state.list.push({ |
||||
|
text: text, |
||||
|
done: false |
||||
|
}) |
||||
|
}, |
||||
|
remove(state, { |
||||
|
todo |
||||
|
}) { |
||||
|
state.list.splice(state.list.indexOf(todo), 1) |
||||
|
}, |
||||
|
toggle(state, todo) { |
||||
|
todo.done = !todo.done |
||||
|
}, |
||||
|
SET_IP(state, ip) { |
||||
|
state.ip = ip |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
export const actions={ |
||||
|
async getIP ({ commit }) { |
||||
|
const ip = await this.$axios.$get('http://icanhazip.com') |
||||
|
commit('SET_IP', ip) |
||||
|
} |
||||
|
} |
||||
|
|