Quaternion rotate multiple local axis x/y

rotate

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)
    object.rotation.setFromQuaternion(result)
}
if (rotY) {
    let mY = new THREE.Quaternion()
    mY.setFromAxisAngle(new THREE.Vector3(0, 1, 0), rotX)
    const result = mY.multiplyQuaternions(mY, object.quaternion)
    object.rotation.setFromQuaternion(result)
}

how to prohibit rotation on the z axis?

rotate!!!
Quaternion does not work from local axis!

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

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:
https://jsfiddle.net/amitlzkpa/ug2howb4/

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!