如何检查nuxt js中是否存在端点?例如,此URL:https://www.google.com/favicon.ico
async asyncData({ app, params, env, error, store }) {
var _icon = "https://www.google.com/favicon.ico";
try {
var result = await app.$axios(_icon);
} catch (error) {
console.log(error)
}
}
[1]: https://i.stack.imgur.com/7RT5K.png
答案 0 :(得分:0)
使用“ $ axios”时,您会忘记“ $ get”
async asyncData({ app, params, env, error, store }) {
var _icon = "https://www.google.com/favicon.ico";
try {
var result = await app.$axios.$get(_icon);
} catch (error) {
console.log(error)
}
}