import axios from 'axios'
export default {
  name: "AjaxText",
  data: function () {
    return {
      message: {}
    }
  },
  mounted() {
    this.cartView();
  },
  methods:{
    cartView() {
      let vm=this;
      axios.get("/static/sites.json", {}).then(function (response) {
        vm.message = response.data;
      })
    }
  }
}

webstrom创建的vue项目,本地json要放在static文件夹下

 

相关文章:

  • 2021-11-22
  • 2021-11-19
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-26
  • 2021-08-10
  • 2021-09-29
  • 2022-12-23
相关资源
相似解决方案