本文介绍了javascript 中的“use"关键字是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看此特定代码行以了解它是什么或查找有关它的一些文档.

I am looking at this specific line of code to understand what it is or to find some documentation about it.

https://github.com/adonisjs/阿多尼斯拉力赛/blob/c7378d2c3984bffba1049f50e771318ea447107c/app/Model/Channel.js

const Lucid = use('Lucid')

我正在尝试使用 mocha 在 adonisjs 中编写一个测试,它给了我以下错误 "ReferenceError: use is not defined"

I am trying to write a test in adonisjs using mocha and it gives me the following error "ReferenceError: use is not defined"

推荐答案

use() 函数由 adonis.js 提供.

使用命名空间或别名获取绑定.

adonis-lucid 包中有一个示例,说明如何创建与您在问题中链接的代码相同的模型.创建模型文档

The adonis-lucid package has an example of how to create a model that looks identical to the code that you've linked in your question. Creating a model docs

这篇关于javascript 中的“use"关键字是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 14:38
查看更多