fox19920726 / threebsp

11 stars 14 forks source link

报错Error in mounted hook: "TypeError: Class constructor Vector3 cannot be invoked without 'new'" #2

Closed FangMeiyan closed 3 years ago

fox19920726 commented 4 years ago

贴一下代码,老哥

zxxliang commented 4 years ago

我用的最新版的three--0.120.1, tthreebsp版本-1.0.8; 在执行官方文档中 new ThreeBSP(sphere)时就报这个错误 TypeError: Class constructor Vector3 cannot be invoked without 'new'

fox19920726 commented 4 years ago

tthreebsp 版本升一下,用1.0.9试试

Evenssi commented 3 years ago

嗯遇到了一样的问题。求救呀

fox19920726 commented 3 years ago

嗯遇到了一样的问题。求救呀

1.0.9也不行吗

Evenssi commented 3 years ago

嗯嗯,我换了threejs的版本了,好像不行,后来找了一个three-js-csg的包,可以用

------------------ 原始邮件 ------------------ 发件人: "23"<notifications@github.com>; 发送时间: 2020年11月23日(星期一) 晚上8:50 收件人: "fox19920726/threebsp"<threebsp@noreply.github.com>; 抄送: "Evenssi"<741005294@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [fox19920726/threebsp] 报错Error in mounted hook: "TypeError: Class constructor Vector3 cannot be invoked without 'new'" (#2)

嗯遇到了一样的问题。求救呀

1.0.9也不行吗

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

fox19920726 commented 3 years ago

嗯嗯,我换了threejs的版本了,好像不行,后来找了一个three-js-csg的包,可以用 ------------------ 原始邮件 ------------------ 发件人: "23"<notifications@github.com>; 发送时间: 2020年11月23日(星期一) 晚上8:50 收件人: "fox19920726/threebsp"<threebsp@noreply.github.com>; 抄送: "Evenssi"<741005294@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [fox19920726/threebsp] 报错Error in mounted hook: "TypeError: Class constructor Vector3 cannot be invoked without 'new'" (#2) 嗯遇到了一样的问题。求救呀 1.0.9也不行吗 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

尴尬。。。我咋能用,哈哈哈哈哈

Evenssi commented 3 years ago

你是换的threejs版本吗?

------------------ 原始邮件 ------------------ 发件人: "23"<notifications@github.com>; 发送时间: 2020年11月23日(星期一) 晚上8:57 收件人: "fox19920726/threebsp"<threebsp@noreply.github.com>; 抄送: "Evenssi"<741005294@qq.com>; "Comment"<comment@noreply.github.com>; 主题: Re: [fox19920726/threebsp] 报错Error in mounted hook: "TypeError: Class constructor Vector3 cannot be invoked without 'new'" (#2)

尴尬。。。我咋能用,哈哈哈哈哈

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Evenssi commented 3 years ago

我现在用的是threejs的107版本

------------------ 原始邮件 ------------------ 发件人: "fox19920726/threebsp" <notifications@github.com>; 发送时间: 2020年11月23日(星期一) 晚上8:57 收件人: "fox19920726/threebsp"<threebsp@noreply.github.com>; 抄送: "Evenssi"<741005294@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [fox19920726/threebsp] 报错Error in mounted hook: "TypeError: Class constructor Vector3 cannot be invoked without 'new'" (#2)

尴尬。。。我咋能用,哈哈哈哈哈

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

fox19920726 commented 3 years ago

用的是threejs的107版本

"three": "^0.110.0",
"three-orbit-controls": "^82.1.0",
"tthreebsp": "^1.0.9",
"vue": "^2.6.10"
FangMeiyan commented 3 years ago

忘记之前提的issue了。贴一下我这边的解决方法。

在webpack.base.conf.js文件里面rules js那块加一下resolve('node_modules/three')

image

!!不过注意:用这种方法的话如果你项目中使用了three-orbit-controls这个库会报新的错 ‘Uncaught TypeError: Cannot assign to read only property 'exports' of object '#'’

建议用官方的鼠标控件import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'

我目前使用的这个版本是没问题的 "three": "^0.120.1", "tthreebsp": "^1.0.9", "vue": "^2.5.2",

如果three版本比较老,用官方的鼠标控件无法引入的话,可以联系我,之前因为这个问题我有改写过一个OrbitControls.js是可以正常引入的,有需要的话我去找下。

fox19920726 commented 3 years ago

忘记之前提的issue了。贴一下我这边的解决方法。

在webpack.base.conf.js文件里面rules js那块加一下resolve('node_modules/three')

image

!!不过注意:用这种方法的话如果你项目中使用了three-orbit-controls这个库会报新的错 ‘Uncaught TypeError: Cannot assign to read only property 'exports' of object '#'’

建议用官方的鼠标控件import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'

我目前使用的这个版本是没问题的 "three": "^0.120.1", "tthreebsp": "^1.0.9", "vue": "^2.5.2",

如果three版本比较老,用官方的鼠标控件无法引入的话,可以联系我,之前因为这个问题我有改写过一个OrbitControls.js是可以正常引入的,有需要的话我去找下。

牛笔!!!!!!