===========app.vue文件=============

<template>
  <div id="app">
      <router-view></router-view>
  </div>
</template>
<script>
export default {
  name: 'App',
  components: {
 
  },
  watch:{
  },
}
</script>
<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
body{
margin:0px auto;
padding:0px;
width: 100%;
    height: 100%;
    /* position: fixed; */
    left: 0;
    z-index: 999;
    overflow:scroll
}
html, body{
  height: 100%;
  width: 100%;
}
html,body{
  height: 100%;
  background: #ececec;
}
html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, h6, form, fieldset, legend, img { margin:0; padding:0; }
fieldset, c{ border:none; }
img{border: none;}
address, caption, cite, code, dfn, th, var { font-style:normal; font-weight:normal; }
ul, ol ,li{ list-style:none; }
a { color:#666; text-decoration:none; }
em{
  font-style: normal;
}
</style>
=========main.js文件==========
import Vue from 'vue'
import App from './App.vue'
import router from './router/router'  (安装路由)
Vue.config.productionTip = false
new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
========copy.文件===========
copy.文件
<template>
  <div class="">
   新建了一个vue页面
  </div>
</template>
<script>
export default {
    name: "",
    components:{
    },
    data(){
      return{
      }
    },
    created:function(){
    },
    methods:{
    },
    mounted:function(){} 
}
</script>
<style lang='less' scoped>
</style>
==========router.js文件============
import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '../pages/index.vue'
Vue.use(VueRouter)
const routes = [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/index',
      name: 'index',
      component: Index,
    },
]
const router = new VueRouter({
  mode: 'hash',
  routes
})
export default router
========vue.config.js文件=========
const webpack = require('webpack')
module.exports = {
  publicPath:'./',       // 根目录地址
  lintOnSave: false,
  configureWebpack: {
    plugins: [
        new webpack.ProvidePlugin({
            $:"jquery",
 
            jQuery:"jquery",
            "windows.jQuery":"jquery"      (安装jq后)
        })
    ],
  },
  css:{ sourceMap: true }//谷歌浏览器显示css行数
}
==========request.js文件 (安装axios后)==========
import axios from 'axios'
export function request(config) {
  const instance = axios.create({
    // baseURL: "http://192.168.x.x:8087",
  })
  instance.interceptors.request.use(config => {
    if(config.url ==='/api/upload'){
      config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
    }
    return config
  }, error => {
    console.log(error)
  })
  instance.interceptors.response.use(res => {
    return res.data
  }, error => {
    console.log(error)
  })
  return instance(config)
}
===========请求方法:============
import {request} from "../request";
export function xxxx(obj) {
  return request({
    url:'/api/xxx/xxx',
    params:{
        'xx':obj.data,
        'xx':obj.id
    }
  })
}
 
 

vue-cli快速搭建项目的几个文件(一)的更多相关文章

  1. 基于Vue-cli 快速搭建项目

    Vue-cli可以快速帮助我们创建一个项目,这是官方给我们提供的脚手架.下面我说一下vue-cli的使用方法. 一.准备工作 在使用vue-cli时,首先需要安装nodejs,npm,其次需全局安装v ...

  2. vue-cli webpack 快速搭建项目

    一.安装vue npm install vue -g 二.用vue-cli快速搭建项目 //全局安装vue-cli npm install install -g vue-cli //创建一个基于web ...

  3. VUE CLI环境搭建文档

    VUE CLI环境搭建文档 1.安装Node.js 下载地址 https://nodejs.org/zh-cn/download/ 2.全局安装VUE CLI win+R键打开运行cmd窗口输入一下代 ...

  4. (转载) android快速搭建项目积累

    android快速搭建项目积累 2016-04-05 20:07 519人阅读 评论(0) 收藏 举报  分类: android优化(8)   Rx技术(5)  版权声明:本文为博主原创文章,未经博主 ...

  5. vue cli创建typescript项目

    使用最新的Vue CLI @vue/cli创建typescript项目,使用vue -V查看当前的vue cli版本 安装命令 npm install -g @vue-cli 创建项目 vue cre ...

  6. Vue CLI创建Vue2项目

    1.安装Node.js * Node.js中包含了npm工具 安装后查看版本: node -v npm -v 2.设置npm的源为国内源 npm config set registry https:/ ...

  7. vue cli3.0快速搭建项目详解(强烈推荐)

    这篇文章主要介绍下vue-cli3.0项目搭建,项目结构和配置等整理一下,分享给大家. 一.介绍 Vue CLI 是一个基于 Vue.js 进行快速开发的完整系统.有三个组件: CLI:@vue/cl ...

  8. vue cli4.0 快速搭建项目详解

    搭建项目之前,请确认好你自己已经安装过node, npm, vue cli.没安装的可以参考下面的链接安装. 如何安装node? 安装好node默认已经安装好npm了,所以不用单独安装了. 如何安装v ...

  9. 使用Vue CLI脚手架搭建vue项目

    本次是使用@vue/cli 3.11.0版本搭建的vue项目 1. 首先确保自己的电脑上的Node.js的版本是8.9版本或者以上 2. 全局安装vue/cli npm install @vue/cl ...

  10. 使用vue-cli(vue脚手架)快速搭建项目

    vue-cli 是一个官方发布 vue.js 项目脚手架,使用 vue-cli 可以快速创建 vue 项目.这篇文章将会从实操的角度,介绍整个搭建的过程. 1. 避坑前言 其实这次使用vue-cli的 ...

随机推荐

  1. Java内存马2-Spring内存马

    Spring内存马 目录 Spring内存马 1.Spring&Spring MVC简介 2.环境搭建 3.Controller内存马 4.踩坑日记 5.Interceptor内存马 1.Sp ...

  2. getElementsByName和getElementById的区别

    1 清洗表名: <input type="text" name="fileName"/><br/> 1 var fileName = d ...

  3. jQuery获得或设置内容和属性、添加属性 append和after的区别

    来自w3school 在线教程 jQuery获得或设置内容和属性 text() - 设置或返回所选元素的文本内容 html() - 设置或返回所选元素的内容(包括 HTML 标记) val() - 设 ...

  4. System.gc 之后到底发生了什么 ?

    本文基于 OpenJDK17 进行讨论 在 JDK NIO 针对堆外内存的分配场景中,我们经常会看到 System.gc 的身影,比如当我们通过 FileChannel#map 对文件进行内存映射的时 ...

  5. #扫描线,并查集,切比雪夫距离#洛谷 5193 [TJOI2012]炸弹

    题目 在平面上有 \(n\) 个炸弹 \([1 \ldots n]\) , 每个炸弹的爆炸范围是 \(|x-x_i|+|y-yi| \leq R\) 如果某个炸弹爆炸了,那么它将引燃它范围内的所有炸弹 ...

  6. 2020.02.05【NOIP提高组】模拟A 组

    [toc] CF293B Distinct Paths=JZOJ 4012 CF261E Maxim and Calculator=JZOJ 4010 JZOJ 2292 PPMM 题目 满足队列出入 ...

  7. OpenHarmony应用开发之自定义弹窗

     本文转载自<OpenHarmony应用开发之自定义弹窗>,作者:zhushangyuan_ 应用场景 在应用的使用和开发中,弹窗是一个很常见的场景,自定义弹窗又因为极高的自由度得以广泛应 ...

  8. 王莉:将开发文档英文化和本地化,我们努力让OpenHarmony走向全球

    编者按:在 OpenHarmony 生态发展过程中,涌现了大批优秀的代码贡献者,本专题旨在表彰贡献.分享经验,文中内容来自嘉宾访谈,不代表 OpenHarmony 工作委员会观点. 王莉 华为技术有限 ...

  9. C++判断操作系统位数

    //判断当前系统是否为64位 BOOL Is64BitSystem() { #ifdef _WIN64 return true; #elif _WIN32 HMODULE hModule = Load ...

  10. SQL中使用年月日来进行分组

    SQL按年月日进行分组 select count(project_name), create_at from table_a group by date_format(create_at, '%Y%m ...