Why does chord.value keep changing while the view layer {{ chord }} only updates once?

  Kiến thức lập trình

enter image description here

I have tried many methods but still can’t solve it.

nexttick:

 for (let input of inputs) {
            // 绑定事件监听器
            input.onmidimessage = (message) => {
                nextTick(() => {
                    chord.value = getMIDIMessage(message);
                });
            };

        }

forceUpdate:

// 遍历每个 MIDI 输入设备
        for (let input of inputs) {
            input.onmidimessage = (message) => {
                chord.value = getMIDIMessage(message);
                this.$forceUpdate();
            };
        }

New contributor

tasy jay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

LEAVE A COMMENT