Vue-cli + axios: cross-domain

Seniors home studio for a given task in the interview as an important basis, and engage in a readhub imitation station, preliminary ideas:

1. vue-router performs route switching pages, configuration reference

2.axios interfaces to get data from api

3. Pre-processor selects less, eslint aside for the time being, and the like adjusted substantially to completion

4. After acquiring data used to generate the page content data

Up to now the problems:

1. The special cross-domain, jsonp cross-domain, api cb I do not know the name of the interface, proxyTable cross-domain, return empty data (Benpian solve)

Id value stitching project will json data after url, that ye should do 2. Click on the news item? To the simple-minded, click Edit url and switch interface? To be considered

3. The drop-down load an earlier news, this can be used to monitor the page scroll bar to achieve distance from the page, but every time I request returns only the most recent 20 data, supposed to be?

Try Quguan network with netword looked at,

Pulled next to some extent, this will return the requested data, whether it is based on the id of the last data before loading to determine eh?

 

Feeling full of expectation? Although even step on a lot of pit road completed, fall and get bruises are inevitable, but maybe I can learn a lot of things? For example axios and promise is now learning of these days

 

 

In fact vue-cli + axios about cross-domain related articles grasping a lot, but I encountered the pit may be too small, no how occur, whether I think a few pages only to see the little details .

Related:

After repeatedly confirmed that no problem npm run dev, but what really made me a return of the old blood erupted

Data I do? ? I packed data? ? Where were you? ?

 

It noted the request path is localhost: 8080 / api / topic, feel should be the path again checked after the circle:

axios.defaults.baseURL will be configured for the port, and therefore will be attached to the front, so it was modified, the modified two files:

 

 

Return to the normal data:

 

Guess you like

Origin www.cnblogs.com/linbudu/p/11199670.html