Commit 2f4f5b46 authored by lipengcheng 's avatar lipengcheng

init

parents
> 1%
last 2 versions
not dead
root = true
# 对所有文件有效 //[*js]只对js文件有效
[*]
charset = utf-8
#缩进类型 可选space和tab
indent_style = space
#缩进数量可选整数值2 or 4,或者tab
indent_size = 4
#换行符的格式 换行符,lf、cr和crlf
end_of_line = lf
# 是否在文件的最后插入一个空行 可选true和false
insert_final_newline = true
# 是否删除行尾的空格 可选择true和false
trim_trailing_whitespace = true
VUE_APP_globalinfo = globalinfo
BASE_URL = 'testurl2'
NODE_ENV = 'passports'
VUE_APP_ENV = passports
package.json
package-lock.json
yarn.lock
!.eslintrc.js
# 忽略有所md文件
*.md
assets/
static/
dist/
node_modules/
module.exports = {
root: true,
env: {
node: true
},
extends: [
'plugin:vue/essential',
'eslint:recommended',
'@vue/prettier',
'plugin:prettier/recommended'
],
parserOptions: {
parser: 'babel-eslint'
},
/**add your custom rules here
* 下面这些rules是用来设置从插件来的规范代码的规则,使用必须去掉前缀eslint-plugin-
* 主要有如下的设置规则,可以设置字符串也可以设置数字,两者效果一致
* "off" 或 0 - 关闭规则
* "warn" 或 1 - 开启规则,使用警告级别的错误:warn (不会导致程序退出)
* "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出)
*/
rules: {
// 是否开启prettier校验,默认开启
// "prettier/prettier": "off",
// "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
'no-console': [0, { llow: ['warn', 'error'] }],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
//缩进风格.默认4,否则会报错
indent: [
2,
4,
{
SwitchCase: 1 // 针对switch case的缩进
}
],
'linebreak-style': ['error', 'unix'],
'no-irregular-whitespace': [
1,
{ skipComments: true, skipTemplates: true, skipRegExps: true }
],
// 强制双引号
// "quotes": ["error", "double"],
// 语句强制分号结尾
// "semi": ["error", "always"],
// "semi": false,
// 分号前后空格。默认选项禁止分号之前有空格,强制分号之后有空格。
'semi-spacing': [
1,
{
before: false,
after: true
}
],
// 变量声明后必须使用;参数arg不做限制
'no-unused-vars': [
1,
{
vars: 'all',
args: 'none'
}
],
// 禁止对原生对象或只读的全局对象进行赋值
'no-native-reassign': 2,
// 变量声明、数组字面量、对象字面量、函数参数 和 序列中的逗号前不能有空格,后面必须有一个空格
'comma-spacing': [
1,
{
before: false,
after: true
}
],
// 是否用驼峰风格命名变量:never || always
camelcase: ['error', { properties: 'never' }],
// 强制函数括号之前的空格的一致性.
// 每个选项可以设置为 "always"、"never" 或 "ignore"
'space-before-function-paren': [
'warn',
{
// 针对匿名函数表达式 (比如 function () {})
anonymous: 'always',
// 针对命名的函数表达式 (比如 function foo () {})。
named: 'never',
// 针对异步的箭头函数表达式(比如 async () => {})
asyncArrow: 'always'
}
],
// 该规则禁止在 return、throw、continue 和 break 语句后出现不可达代码。
'no-unreachable': 1,
// 消除非故意 case 落空行为
'no-fallthrough': 1,
// 在条件语句中,很容易将一个比较运算符(像 ==)错写成赋值运算符(如 =)
// 所以,该规则禁止在 if、for、while 和 do...while 语句中出现模棱两可的赋值操作符
'no-cond-assign': [2, 'always'],
// 强制多行的三目运算符换行
'multiline-ternary': [1, 'always-multiline'],
// else关键字要与花括号保持在同一行。
// 'brace-style': 1,
// 'block-spacing': 1, //单行代码块两边加空格。
// 'spaced-comment': 1, //注释首尾留空格
'vue/html-indent': [
'error',
4,
{
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: []
}
],
// 是否禁止在正则表达式中出现控制字符
'no-control-regex': 0,
// 指定html各种元素、svg、vue组件自闭和标签的规则
'vue/html-self-closing': [
'error',
{
html: {
void: 'never',
normal: 'never',
component: 'never'
},
svg: 'always',
math: 'always'
}
],
// 每一行的属性数量
'vue/max-attributes-per-line': [
'error',
{
// 单行的话,每行属性的数量
singleline: 2,
// 多行的话,每行属性的数量
multiline: {
max: 1,
// 第一个属性是否与开始标签在同一行
allowFirstLine: false
}
}
],
'vue/multiline-html-element-content-newline': [
'error',
{
ignoreWhenEmpty: true,
ignores: ['pre', 'textarea'],
allowEmptyLines: false
}
],
// 单行元素内容是否换行
'vue/singleline-html-element-content-newline': [
0,
{
ignoreWhenEmpty: true,
ignores: ['pre', 'textarea'],
ignoreWhenNoAttributes: true
}
],
// 多行元素闭合标签(右括号)换行规则
'vue/html-closing-bracket-newline': [
'error',
{
singleline: 'never',
multiline: 'never'
}
],
// 单行元素闭合标签(右括号)换行规则
'vue/html-closing-bracket-spacing': [
'error',
{
startTag: 'never',
endTag: 'never',
selfClosingTag: 'never'
}
],
// 属性值引号:"double" | "single"
'vue/html-quotes': ['error', 'double'],
// 组件name属性值的格式
// PascalCase:驼峰 || kebab-case:连接线
'vue/name-property-casing': ['warn', 'PascalCase'],
// v-bind写法。shorthand:简写 || longform:不缩写
'vue/v-bind-style': ['error', 'shorthand'],
'vue/v-on-style': ['error', 'shorthand'],
// html元素中属性顺序
'vue/attributes-order': [
'warn',
{
order: [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'TWO_WAY_BINDING',
'OTHER_DIRECTIVES',
'OTHER_ATTR',
'EVENTS',
'CONTENT'
]
}
],
// 组件中属性的顺序
'vue/order-in-components': [
'warn',
{
order: [
'el',
'name',
'parent',
'functional',
['delimiters', 'comments'],
['components', 'directives', 'filters'],
'extends',
'mixins',
'inheritAttrs',
'model',
['props', 'propsData'],
'data',
'computed',
'watch',
'LIFECYCLE_HOOKS',
'methods',
['template', 'render'],
'renderError'
]
}
],
// 强制在v-on方法后加括号
'vue/v-on-function-call': [2, 'never'],
// 报告<template>中的语法错误
'vue/no-parsing-error': [
2,
{
'x-invalid-end-tag': false
}
],
// 去掉检测无用转义的规则
'no-useless-escape': [0]
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
node_modules/
.nuxt/
dist/
.prettierrc.js
assets/
# 所有的markdown文件
*/.md
module.exports = {
// 与eslint集成(让prettier使用eslint的代码格式进行校验)
eslintIntegration: true,
// 换行长度
printWidth: 100,
// tab缩进大小,默认为2
tabWidth: 4,
// 使用tab缩进,默认false
useTabs: false,
// 使用分号, 默认true
semi: false,
// 使用单引号, 默认false(在jsx中配置无效, 默认都是双引号)
singleQuote: true,
// 行尾逗号,默认none,可选 none|es5|all
// es5 包括es5中的数组、对象
// all 包括函数对象等所有可选
trailingComma: 'none',
// 对象中的空格 默认true
// true: { foo: bar }
// false: {foo: bar}
bracketSpacing: true,
// JSX标签闭合位置 默认false
// false: <div
// className=""
// style={{}}
// >
// true: <div
// className=""
// style={{}} >
// jsxBracketSameLine:false,
// 箭头函数参数括号 默认avoid 可选 avoid| always
// avoid 能省略括号的时候就省略 例如x => x
// always 总是有括号
arrowParens: 'always'
}
# Changelog
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
## [1.0.0](https://gitee.com/mslevin/template-vuecli3/compare/v0.1.1...v1.0.0) (2020-08-25)
### [0.1.1](https://gitee.com/mslevin/template-vuecli3/compare/v0.1.0...v0.1.1) (2020-08-25)
## 0.1.0 (2020-08-25)
### Features
* 一个feature ([ca84a6a](https://gitee.com/mslevin/template-vuecli3/commit/ca84a6a89ada0d37abeb94106fc1616f6a3434fd))
# laihua-toolkit
## Project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn run serve
```
### Compiles and minifies for production
```
yarn run build
```
### Run your tests
```
yarn run test
```
### Lints and fixes files
```
yarn run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: ['@vue/cli-plugin-babel/preset']
}
let baseUrl = ''
console.log('process.env:', process.env)
console.log('process.env.NODE_ENV:', process.env.NODE_ENV)
//
switch (process.env.NODE_ENV) {
case 'development':
baseUrl = 'http://localhost:3000/development' //开发环境url
break
case 'passports': // 注意这里的名字要和步骤二中设置的环境名字对应起来
baseUrl = 'http://localhost:3000/passports' //测试环境中的url
break
case 'production':
baseUrl = 'http://106.13.94.82:3000/production' //生产环境url
break
}
export default baseUrl
{
"name": "laihua-toolkit",
"version": "1.0.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"passports": "vue-cli-service build --mode passports",
"build": "vue-cli-service build",
"start": "serve -l 3018 dist",
"lint": "vue-cli-service lint",
"fix": "eslint --fix --ext .js,.vue src",
"prettier": "prettier --write \"src/**/*.js\" \"src/**/*.vue\" ./*.js",
"commit": "git cz",
"release:init": "standard-version --first-release ",
"release:patch": "standard-version --release-as patch ",
"release:minor": "standard-version --release-as minor ",
"release:major": "standard-version --release-as major "
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "echo 'pushing....'",
"...": "..."
}
},
"lint-staged": {
"**/*.{js,vue}": [
"prettier --write",
"eslint --fix"
]
},
"dependencies": {
"axios": "^0.20.0",
"core-js": "^3.6.5",
"register-service-worker": "^1.7.1",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.5.0",
"@vue/cli-plugin-eslint": "^4.5.0",
"@vue/cli-plugin-pwa": "^4.5.0",
"@vue/cli-service": "^4.5.0",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"commitizen": "^4.2.0",
"cz-conventional-changelog": "^3.2.1",
"element-ui": "^2.13.2",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^6.2.2",
"husky": "^3.1.0",
"lint-staged": "^10.2.11",
"node-sass": "^4.12.0",
"prettier": "^1.19.1",
"sass-loader": "^8.0.2",
"standard-version": "^9.0.0",
"vue-template-compiler": "^2.6.11"
}
}
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.00251 14.9297L0 1.07422H6.14651L8.00251 4.27503L9.84583 1.07422H16L8.00251 14.9297Z" fill="black"/>
</svg>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
User-agent: *
Disallow:
<template>
<div id="app">
<common-header></common-header>
<body class="body-container">
<side-nav></side-nav>
<router-view style="flex:1;border: 1px solid #666;"></router-view>
<right-panel></right-panel>
</body>
</div>
</template>
<script>
import CommonHeader from '@/components/header/index.vue'
export default {
components: {
CommonHeader,
SideNav: () => import('@/components/sideNav/index.vue'),
RightPanel: () => import('@/components/rightPanel/index.vue')
},
data() {
return {}
},
async created() {
console.log('this.$http:', this.$http)
let result = await this.$http.get('/webapi/home/banner?type=1&category=18')
console.log('result:', result)
}
}
</script>
<style lang="scss">
* {
box-sizing: border-box;
line-height: 1;
margin: 0;
padding: 0;
}
html,
body {
padding: 0;
margin: 0;
}
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
display: flex;
flex-direction: column;
height: 100vh;
}
.body-container {
flex: 1;
display: flex;
justify-content: space-between;
}
</style>
<template>
<div class="comp-commonheader">
<h1>LAIHUA</h1>
<div class="current-page">当前的宝</div>
<tip-panel></tip-panel>
</div>
</template>
<script>
export default {
components: {
tipPanel: () => import('@/components/header/tipPanel.vue')
},
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.comp-commonheader {
width: 100%;
height: 100px;
border: 1px solid pink;
display: flex;
align-items: center;
justify-content: flex-start;
}
</style>
<template>
<div class="comp-header-tippanel">
怎么操作?
</div>
</template>
<script>
export default {
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
</style>
<template>
<div class="comp-rightpanel">
rightpanel
</div>
</template>
<script>
export default {
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.comp-rightpanel {
width: 150px;
height: 100%;
border: 1px solid skyblue;
}
</style>
<template>
<div class="comp-sidenav">
<router-link to="/">Home</router-link>
<router-link to="/about">About</router-link>
<router-link to="/bao1">bao1</router-link>
<router-link to="/bao2">bao2</router-link>
</div>
</template>
<script>
export default {
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.comp-sidenav {
padding: 30px;
// width: 100px;
border: 1px solid skyblue;
height: 100%;
// display: flex;
a {
font-weight: bold;
color: #2c3e50;
display: inline-block;
width: 100%;
padding: 10px 0;
&.router-link-exact-active {
color: #42b983;
}
}
}
</style>
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './registerServiceWorker'
import axios from 'axios'
import baseURL from '../config/baseUrl.js'
console.log('baseURL:', baseURL)
Vue.config.productionTip = false
Vue.prototype.$http = axios
new Vue({
router,
store,
render: (h) => h(App)
}).$mount('#app')
/* eslint-disable no-console */
import { register } from 'register-service-worker'
if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, {
ready() {
console.log(
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
)
},
registered() {
console.log('Service worker has been registered.')
},
cached() {
console.log('Content has been cached for offline use.')
},
updatefound() {
console.log('New content is downloading.')
},
updated() {
console.log('New content is available; please refresh.')
},
offline() {
console.log('No internet connection found. App is running in offline mode.')
},
error(error) {
console.error('Error during service worker registration:', error)
}
})
}
import Vue from 'vue'
import VueRouter from 'vue-router'
import Bao3 from '../views/bao3.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Bao3',
component: Bao3
},
{
path: '/about',
name: 'About',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
},
{
path: '/bao1',
name: 'Bao1',
component: () => import(/* webpackChunkName: "bao1" */ '../views/bao1.vue')
},
{
path: '/bao2',
name: 'Bao2',
component: () => import(/* webpackChunkName: "bao2" */ '../views/bao2.vue')
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {},
mutations: {},
actions: {},
modules: {}
})
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>
<template>
<div class="comp-bao1">
bao1
</div>
</template>
<script>
export default {
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
</style>
<template>
<div class="comp-bao2">
bao2
</div>
</template>
<script>
export default {
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
</style>
<template>
<div class="comp-bao2">
bao3
<!-- <img src="../assets/logo.png" alt=""> -->
</div>
</template>
<script>
export default {
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
</style>
console.log(`process.env1:`, process.env)
console.log(`process.env.NODE_ENV1:`, process.env.NODE_ENV)
// dsf
//dfdfdfsdf
module.exports = {
// outputDir: process.env.outputDir,
// assetsDir: 'static',
publicPath: '/',
devServer: {
open: true,
// host: '0.0.0.0',
port: 3018,
https: false,
hotOnly: false,
proxy: {
webapi: {
target: 'https://test2.laihua.com/',
ws: true,
changeOrigin: true,
pathRewrite: { '^/webapi': '/' }
}
}
}
}
This diff is collapsed.
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