解决:
// 1. 将contentWindow保存到变量
const iWindow = (this.$refs.editorFrame as HTMLIFrameElement).contentWindow; // 此时的iWindow类型为 Window | null
// 2. 将iWindow进行断言
iWindow as Window
// 完整代码
getIframeWindow(): Window {
const iFrame = (this.$refs.editorFrame as HTMLIFrameElement).contentWindow;
return iFrame as Window
}