Sorry, the following request of the link, I will hide the domain name, so want to try to find a friend trouble themselves for a new test, I'm sorry
Cross-domain is also configured below
1.config/index.js configuration: Troubleshooting cross-domain dev: {env:require ('./dev.env '), port:8008, Autoopenbrowser:false, Assetssubdirector Y: ' Static ', Assetspublicpath: '/', proxytable: {'/ajaxurl ': {target: ' https://www.aaaaaaa.com/', Changeo Rigin:true, Pathrewrite: {' ^/ajaxurl ': '/'}}} 2.main.js configuration: Use Axios: Note Line 25th, add it to the prototype chain instead of using U
Se method import Vue from ' Vue ' import App from './app ' import Axios from ' Axios ' Vue.prototype. $http =axios; New Vue ({el: ' #app ', render:h => H (APP)}) 3.app.vue: Invoke Ajax: Line 45th, Axios support Promise method, so write convenient point <template> <di V id= "App" > huoqu <button @click = "Myajax" > Get home Information </button> </div> </template> <script>
; Export Default {name: ' app ', components: {}, Data:function () {}, methods: {myajax:function () {this. $ht
Tp.get ("/ajaxurl/welfare/gpa/index/index"). Then (response => {console.log ("success in Obtaining Information") Console.log (response); }, Response => {Console.log ("Get information Failed") Console.log (response); }}}} </script> <style> </style>
The final effect is this:
This is the most basic, relatively simple, we can try