methods: { setCameraPostion: (()=>{ let _eye = new Vector3(); let eyeDirection = new Vector3(); let target = new Vector3(); let distance, newDistance; return function setCameraPostion(args) { _eye.copy(args.pos).sub(target); eyeDirection.copy(_eye).normalize(); distance = _eye.length(); newDistance = ...(有点长,略过); eyeDirection.setLength(newDistance).add(target); return eyeDirection; } })(), }
以上写法是可以执行的,我想问得是这种写法是否可取?需不需要优化?
个人感觉这种辅助变量写在data里很别扭...强迫症了快
但缺点是无法使用this——不知道怎么用
谢谢
MMTTMM
相关分类