提交 351e5e0a authored 作者: 吴旭健1's avatar 吴旭健1

第一次上传

上级
> 1%
last 2 versions
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
parserOptions: {
ecmaVersion: 2020
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-catch-shadow': 2,//禁止catch子句参数与外部作用域变量同名
'no-class-assign': 2,//禁止给类赋值
'camelcase': 2,//强制驼峰法命名
'vars-on-top': 2,//var必须放在作用域顶部
'no-redeclare': 2,//禁止重复声明变量
'complexity': [0, 11]//循环复杂度
}
}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# test1
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
/**
* Created by tengteng on 17/12/27.
*/
// 服务地址
const IP = 'https://www.easy-mock.com/mock/5b70ec93ad23a1570071a34e/Interview'; // easymock
// 请求目标服务器域名配置
const DOMAIN_NAME = {
URL_CNODEJS: IP, // 网关 服务端口
};
export default DOMAIN_NAME;
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "test1",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.19.2",
"element-ui": "^2.13.0",
"vue": "^2.6.11",
"vue-router": "^3.1.5",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-eslint": "~4.2.0",
"@vue/cli-plugin-router": "~4.2.0",
"@vue/cli-plugin-vuex": "~4.2.0",
"@vue/cli-service": "~4.2.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.1.2",
"vue-template-compiler": "^2.6.11"
}
}
<!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>
<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view/>
</div>
</template>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
#nav {
padding: 30px;
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
</style>
<template>
<div class="hello">
<el-upload
class="upload-demo"
drag
action="https://jsonplaceholder.typicode.com/posts/"
multiple>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div>
</el-upload>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
import Vue from 'vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue';
import router from './router';
import store from './store';
import server from './services/server';
Vue.prototype.$server = server;
Vue.use(ElementUI);
Vue.config.productionTip = false
new Vue({
router,
store,
render: function (h) { return h(App) }
}).$mount('#app')
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'Home',
component: Home
},
{
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: function () {
return import(/* webpackChunkName: "about" */ '../views/About.vue')
}
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
import axios from 'axios';
// import Qs from 'qs';
import baseUrl from '../../config';
import store from '../store';
// axios.defaults.withCredentials = true;
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
// console.log(store.getters.getSession.session)
// config.headers.session = store.getters.getSession.session;
// 预处理请求信息(config 发出的数据) 下方是三种请求,李迪凡的
if (config.method === 'post' || config.method === 'put' || config.method === 'delete') {
// POST传参序列化
}
return config;
}, function (error) {
// 预处理请求错误(error)
return Promise.reject(error);
});
// 添加响应拦截器
axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
// 预处理响应错误(error)
// alert(error);
return Promise.reject(error);
});
/**
* 返回axios方法
* @param url(如果传绝对地址则baseURL不会追加到url之前)
* @param method
* @param timeout
* @param data
* @param headers
* @param dataType
* @returns {AxiosPromise}
*/
export default function(url, {
// 不传时,默认参数
method = 'get',
timeout = 60000,
data = {},
headers = {'Content-Type': 'application/json'}, // application/x-www-form-urlencoded;charset=UTF-8;
dataType = 'json'
}) {
const config = {
method: method,
timeout: timeout,
url: url, // 如果URL是完整的,包含域名,则下方的域名不会被拼接
baseURL: baseUrl.URL_CNODEJS, // 域名,在最外层的config.js当中可以修改,请求目标服务器域名配置,结合我们自己的项目,在项目放置到服务器上时,就是将域名替换成192.168.1.3
data: data,
headers: headers,
dataType: dataType
};
return axios(config);
}
import axios from '@/services/axios';
/**
* 统一处理所有接口请求
* 参数对象将会替换axios中默认参数中的键值对,其中可包含:
* method
* timeout
* data
* headers
* dataType
*/
// import qs from 'qs';
const server = {
getCeShi() { // 测试接口
return axios('/resume', {
method: 'get'
});
},
postadd(data) { // 新增角色
return axios('/role/add', {
method: 'post',
data: data
});
},
}
export default server;
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
state: {
},
mutations: {
},
actions: {
},
modules: {
}
})
<template>
<div class="about">
<button @click="ceGet">获取数据</button>
<span>数据:{{ this.dataGet }}</span>
</div>
</template>
<script>
export default {
data () {
return {
dataGet: ''
}
},
created() {
},
mounted(){
},
methods: {
// 测试数据接口
ceGet() {
console.log('你好数据');
this.$server.getCeShi().then(res => {
console.log(res);
}).catch(err => {
console.log(err);
this.$message.error('数据请求失败');
})
}
},
components: {
},
watch: {
}
}
</script>
<template>
<div class="home">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
export default {
name: 'Home',
components: {
HelloWorld
}
}
</script>
// vue框架配置文件
module.exports = {
// 基本路径
publicPath: './',
// 输出文件目录
outputDir: 'Drag',
// eslint-loader 是否在保存的时候检查
lintOnSave: true,
assetsDir: 'static',
// use the full build with in-browser compiler?
// https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
// compiler: false,
// webpack配置
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
chainWebpack: config => {
// 其他配置
// config.entry('main').add('babel-polyfill') // main是入口js文件
// 其他配置
},
configureWebpack: () => {},
// vue-loader 配置项
// https://vue-loader.vuejs.org/en/options.html
// vueLoader: {},
// 生产环境是否生成 sourceMap 文件
productionSourceMap: true,
// css相关配置
css: {
// 是否使用css分离插件 ExtractTextPlugin
// extract: true,
// 开启 CSS source maps?
sourceMap: false,
// css预设器配置项
loaderOptions: {},
// 启用 CSS modules for all css / pre-processor files.
modules: false
},
// use thread-loader for babel & TS in production build
// enabled by default if the machine has more than 1 cores
parallel: require('os').cpus().length > 1,
// 是否启用dll
// See https://github.com/vuejs/vue-cli/blob/dev/docs/cli-service.md#dll-mode
// dll: false,
// PWA 插件相关配置
// see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
pwa: {},
// webpack-dev-server 相关配置
devServer: {
open: true,
host: 'localhost',
port: 8088,
https: false,
hotOnly: false,
proxy: null, // 设置代理
before: app => {}
},
// 第三方插件配置
pluginOptions: {
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论