Some question about camera rotation with quaternion

I used euler rotation to interact with the phone screen this.euler.x and this.euler.y are two coefficients. when you touch and move your finger on the screen this.euler.x and this.euler.y will change, thereby allowing the camera to change the angle like the video below

And video

but when i use quaternion rotation with this.v.x and this.v.y same with this.euler.x and this.euler.y it get error like below video. please help me, i really don’t understand the quaternion rotation. But due to some gimbal locking problem with euler rotation, I have to switch to quaternion rotation
My code :

My code and video