我正在尝试将vue-auth图像插件集成到Nuxt.js中。
在plugins/auth-images.js中
import Vue from 'vue'
import VueAuthImage from 'vue-auth-image'
import axios from 'axios'
Vue.use(VueAuthImage)
if (process.browser) {
const authHeader = 'Bearer ' + localStorage.getItem('my-own-id-token')
axios.defaults.headers.common.Authorization = authHeader
} 在nuxt.config.js,中,我将这个插件命名为:
plugins: [
'@/plugins/auth-images'
]在后面的代码中,我应用了以下内容:
<img v-auth-img="link/to/my/api/endpoint">在控制台中,我得到了这样的信息:
Vue警告:未能解决指令: auth-img
怎么解决这个问题?
发布于 2019-06-26 12:35:53
指令不是auth,而是auth图像,所以正确的代码是:
<img v-auth-image=https://stackoverflow.com/questions/55395821
复制相似问题