这应该可以了
<script type="text/discourse-plugin" version="0.8">
const later = require("@ember/runloop").later;
api.modifyClass("component:share-popup", {
_focusUrl() {
this._super(...arguments);
// 需要使用 later,因为 https://git.io/JfmTU
later(() => {
if (this.element) {
const linkInput = this.element.querySelector("#share-link input");
linkInput.value = this.link.split("?")[0];
}
}, 200);
}
});
</script>