Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.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 js网页包错误-未捕获类型错误:Vue.directive不是函数_Vue.js_Webpack_Vuejs2_Vue Loader - Fatal编程技术网

Vue.js Vue js网页包错误-未捕获类型错误:Vue.directive不是函数

Vue.js Vue js网页包错误-未捕获类型错误:Vue.directive不是函数,vue.js,webpack,vuejs2,vue-loader,Vue.js,Webpack,Vuejs2,Vue Loader,需要帮助修复以下错误: Vue.directive不是一个函数 我正在使用Vue Webpack样板文件进行前端项目 以下是该项目的结构: 我得到以下错误 [HMR] Waiting for update signal from WDS... webpack-internal:///./src/helpers/directives.js:1 Uncaught TypeError: Vue.directive is not a function at eval (webpack-inte

需要帮助修复以下错误:

Vue.directive不是一个函数

我正在使用Vue Webpack样板文件进行前端项目

以下是该项目的结构:

我得到以下错误

[HMR] Waiting for update signal from WDS...
webpack-internal:///./src/helpers/directives.js:1 Uncaught TypeError: Vue.directive is not a function
    at eval (webpack-internal:///./src/helpers/directives.js:1)
    at Object../src/helpers/directives.js (app.js:4759)
    at __webpack_require__ (app.js:708)
    at fn (app.js:113)
    at Object.eval (webpack-internal:///./src/bootstrap.js:44)
    at eval (webpack-internal:///./src/bootstrap.js:142)
    at Object../src/bootstrap.js (app.js:4568)
    at __webpack_require__ (app.js:708)
    at fn (app.js:113)
    at eval (webpack-internal:///./src/main.js:22)
webpack-internal:///./node_modules/vue/dist/vue.esm.js:9075 Download the Vue Devtools extension for a better development experience:
https://github.com/vuejs/vue-devtools
webpack-internal:///./node_modules/vue/dist/vue.esm.js:9086 You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html

helper\directions.js

Vue.directive('click-outside', {
    bind: function (el, binding, vnode) {
      el.event = function (event) {
        // here I check that click was outside the el and his childrens
        if (!(el === event.target || el.contains(event.target))) {
          // and if it did, call method provided in attribute value
          vnode.context[binding.expression](event)
        }
      }
      document.body.addEventListener('click', el.event)
    },
    unbind: function (el) {
      document.body.removeEventListener('click', el.event)
    }
  })


您能否显示
/helpers/directions.js
它不是样板文件的一部分,您的问题只是缺少
从“Vue”导入Vue