我从 "stimulus": "^2.0.0" 迁移到了 "@hotwired/stimulus": "^3.0.0"。
但是,在 new _default (message_list_controller.js:1) 处出现了错误Uncaught TypeError: Class constructor Controller cannot be invoked without 'new'
我不确定 message_list_controller.js 出了什么问题,因为我只是从 import { Controller } from "stimulus" 改成了 import { Controller } from "@hotwired/stimulus"。
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
this.scrollToBottom()
}
scrollToBottom() {
this.element.scrollTop = this.element.scrollHeight
}
}
有人能建议我如何解决这个问题吗?