| vue-resource 导入 还有elementui导入方法都是一样 这里就以vue-resource为例
  
 importVueResource from 'vue-resource'  
 Vue.use(VueResource)   /* eslint-disable */
<template>
  <div class="hello" style="background: fuchsia">
    <h1>您登陆{{ msg }}</h1>
    <button v-on:click="showDetails">获取20服务器上接收所信息</button>
  </div>
</template>
<script>
export default {
  name: 'hello',
  data () {
    return {
      msg: ''
    }
  },
  methods: {
    showDetails: function () {
      this.$http.post('api/RMSClient/useradmin/login?password=d90b21c4a61992ff330bade33e84633d&userName=444').then(function (res) {
        console.log(res) // 返回很多的数据,比如执行状态,url,data等等
console.log(res.data)// 返回的json数据
console.log(res.data.message)// json对象里面的信息
this.msg = res.data.message
      })
    }
  }
}
</script> |