Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 将vue auth image插件集成到Nuxt.js中_Vue.js_Vuejs2_Nuxt.js - Fatal编程技术网

Vue.js 将vue auth image插件集成到Nuxt.js中

Vue.js 将vue auth image插件集成到Nuxt.js中,vue.js,vuejs2,nuxt.js,Vue.js,Vuejs2,Nuxt.js,我正在尝试将插件集成到Nuxt.js 在plugins/auth-images.js中: 从“Vue”导入Vue 从“vue验证图像”导入VUEAuth图像 从“axios”导入axios Vue.usevueuthimage 如果process.browser{ const authHeader='Bearer'+localStorage.getItem'my-own-id-token' axios.defaults.headers.common.Authorization=authHeade

我正在尝试将插件集成到Nuxt.js

在plugins/auth-images.js中:

从“Vue”导入Vue 从“vue验证图像”导入VUEAuth图像 从“axios”导入axios Vue.usevueuthimage 如果process.browser{ const authHeader='Bearer'+localStorage.getItem'my-own-id-token' axios.defaults.headers.common.Authorization=authHeader } 在nuxt.config.js中,我将此插件称为:

plugins: [                                                                                                                                     
  '@/plugins/auth-images'                                                                                                                   
]
在我的代码后面,我将应用以下内容:

在控制台中,我得到以下信息:

[Vue warn]:无法解析指令:auth img


如何解决此问题?

指令不是auth img,而是auth image,因此正确的代码是:

<img v-auth-image=

您将文件命名为auth-images.js,因此在您的配置@/plugins/auth-images中有一个输入错误,而不是@/plugins/vauth-images。感谢您的关注,抱歉,我只是在这里输入了错误,在我的实际代码中我没有输入,我使用了不同的名称