Ver Fonte

this 别名的使用情景

dusenyao há 1 ano atrás
pai
commit
45ce53f777

+ 2 - 1
src/views/exercise_questions/preview/components/common/Strockplayredline.vue

@@ -62,9 +62,10 @@ export default {
   // 方法集合
   methods: {
     initHanziwrite() {
+      let _this = this;
       this.writer = HanziWriter.default.create(this.targetDiv, this.bookText, {
         charDataLoader(char, onComplete) {
-          onComplete(this.bookStrokes);
+          onComplete(_this.bookStrokes);
         },
         padding: 5,
         showOutline: true,

+ 2 - 1
src/views/exercise_questions/preview/components/common/Strockred.vue

@@ -68,9 +68,10 @@ export default {
   // 方法集合
   methods: {
     initHanziwrite() {
+      let _this = this;
       let options = {
         charDataLoader(char, onComplete) {
-          onComplete(this.bookStrokes);
+          onComplete(_this.bookStrokes);
         },
         padding: 5,
         showCharacter: false,