Quaternion rotate multiple local axis x/y


made by example

if (rotX) {
    let mX = new THREE.Quaternion()
    mX.setFromAxisAngle(new THREE.Vector3(1, 0, 0), rotY)
    const result = mX.multiplyQuaternions(mX, object.quaternion)
if (rotY) {
    let mY = new THREE.Quaternion()
    mY.setFromAxisAngle(new THREE.Vector3(0, 1, 0), rotX)
    const result = mY.multiplyQuaternions(mY, object.quaternion)

how to prohibit rotation on the z axis?

Quaternion does not work from local axis!

let euler = new THREE.Euler(0, 0, 0, 'ZYX');
euler.set(rotY, rotX, 0);

Can you share a fiddle or something of what you are trying to do.
Very difficult to guess.

Do you want to be something like this:

The result is higher in animation and code. How to make on quaterions?

Sorry. Very difficult to give any input with what you are saying.
All the best!