Explorar o código

fix(pptEasy/addCourse3): 修复setCourseUrl中this指向错误的问题

将普通函数改为箭头函数并使用_this保存this指向,修正了回调中无法正确访问组件实例的问题
lsc hai 1 hora
pai
achega
78bc290306
Modificáronse 1 ficheiros con 5 adicións e 4 borrados
  1. 5 4
      src/components/pages/pptEasy/addCourse3.vue

+ 5 - 4
src/components/pages/pptEasy/addCourse3.vue

@@ -3829,10 +3829,11 @@ export default {
       this.dialogVisiblePublish = true;
     }
     window.openCourseSettings = () => this.openCourseSettings();
-    window.setCourseUrl = function(){
-      console.log(this.courseUrl)
-      this.courseUrl = ''
-      console.log(this.courseUrl)
+    let _this = this;
+    window.setCourseUrl = () => {
+      console.log(_this.courseUrl)
+      _this.courseUrl = ''
+      console.log(_this.courseUrl)  
     }
   }
 };