gpt4 book ai didi

javascript - 如何导入 GPU.js?

转载 作者:行者123 更新时间:2023-11-29 23:02:11 25 4
gpt4 key购买 nike

我正在尝试在 Vue 中使用 GPU.js。我不知道如何导入它。我现在正在尝试这个:

import * as GPU from "gpu.js";

如果我这样做,我可以在我的组件中使用 this 关键字来 console.log 对象。

我无法实例化它,我不知道如何在我的 Vue 组件中执行此操作:

  const gpu = new GPU();

我收到此错误消息

GPU is not defined

如何正确导入 GPU.js?

最佳答案

import { GPU } from "gpu.js";
const gpu = new GPU();

或者像你一样

import * as GPU from "gpu.js";
const gpu = new GPU.GPU();

库不只是导出构造函数。也许应该改进文档 ;)

关于javascript - 如何导入 GPU.js?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55402071/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com