• 安装组件
# 进入项目目录
$ cd myweb
$ npm install --save --save-exact axios vue-axios
npm WARN ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself. npm WARN bootstrap@4.4.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself. npm WARN bootstrap@4.4.1 requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
  • vue-axios@2.1.5
  • axios@0.19.2
    added 4 packages from 8 contributors in 11.461s

26 packages are looking for funding
run npm fund for details

  • 编辑main.js引入
import axios from 'axios'
import VueAxios from 'vue-axios'

Vue.use(VueAxios,axios)
  • js代码
<template>
  <div class="hello">
    <pre>{{content}}</pre>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  data () {
    return {
      content:""
    }
  },
  mounted() {
    this.axios.post("http://api.komavideo.com/new/list").then(body => {
      this.content = body.data;
    })
  }
}
</script>

相关文章:

  • 2021-09-14
  • 2021-12-15
  • 2022-12-23
  • 2021-11-25
  • 2021-11-06
  • 2021-11-06
  • 2022-12-23
  • 2021-07-14
猜你喜欢
  • 2022-12-23
  • 2021-06-06
  • 2022-01-20
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
相关资源
相似解决方案