Vuetify/Javascript why am I getting a ReferenceError: variable is not defined

Vuetify/Javascript why am I getting a ReferenceError: variable is not defined

我在 Vuetify 工作,我正在尝试使用 Prometheus 的 javascript 客户端,以便将一些数据导入我的应用程序。据我所知,该页面是 Here 我遵循了他们的示例,但是当我尝试 运行 时,我不断收到 ReferenceError: Prometheus is not defined 。我的代码在这里:

<script>
import 'prometheus-query'

 const prom = new PrometheusDriver({'removed for security'
 }
 })
 const q = 'count(node_uname_info{job="MAK_Eos_Lab"})'
 prom.instantQuery(q)
   .then((res) => {
    console.log(res.result)
 })
.catch(console.error)

export default {
 name: 'Mackinac',
}
</script>

您应该在使用前导入它:

 import { PrometheusDriver } from 'prometheus-query';

然后使用它:

 const prom = new PrometheusDriver(...)