Nuxt js检查端点是否存在

问题描述 投票:0回答:1

如何检查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
javascript vue.js nuxt
1个回答
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)
      }

}
© www.soinside.com 2019 - 2024. All rights reserved.