[英]Using vue-underscore in Nuxt.js
I'm currently reworking an application that I was making in VueJS for Nuxt, however I get an error missing stack frames that I can't find much about – I'm trying to use vue-underscore
and while previously in VueJS this worked fine, I'm now having this missing stack frames error message appear.我目前正在重新编写我在 VueJS 中为 Nuxt 制作的应用程序,但是我得到一个错误,缺少堆栈帧,我找不到太多关于 - 我正在尝试使用vue-underscore
,而之前在 VueJS 中这工作正常,我现在有这个丢失的堆栈帧错误消息出现。
In a vue-underscore.js
file I setup underscore like this:在vue-underscore.js
文件中,我像这样设置下划线:
import Vue from 'vue'
import underscore from 'vue-underscore'
Vue.use(underscore)
I import {_}
like this in my component:我在我的组件中像这样导入{_}
:
import {_} from 'vue-underscore';
Error message here:这里的错误信息:
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ =
__webpack_require__(/*! vue */ "vue");
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default =
/*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var vue_underscore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-underscore */ "vue-underscore");
/* harmony import */ var vue_underscore__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(vue_underscore__WEBPACK_IMPORTED_MODULE_1__);
vue__WEBPACK_IMPORTED_MODULE_0___default.a.use(vue_underscore__WEBPACK_IMPORTED_MODULE_1___default.a);
Any help gratefully received.感激地收到任何帮助。
I had the same problem.我有同样的问题。 We both were badly using it!我们俩都用得不好!
Let's summarize.让我们总结一下。
npm install vue-underscore
OR或者
yarn add vue-underscore
import Vue from 'vue'
import underscore from 'vue-underscore'
Vue.use(underscore)
plugins: [{ src: '~/plugins/underscore', ssr: false }]
<script>
export default {
name: 'MyComponent',
mounted() {
console.log(this.$_.range(2000, 2020))
}
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.