|
@@ -5,7 +5,7 @@
|
|
|
</div>
|
|
|
<div class="character-target-box">
|
|
|
<SvgIcon icon-class="hanzi-writer-bg" class="character-target-bg" />
|
|
|
- <div :id="targetDiv" class="character-target-div"></div>
|
|
|
+ <div :id="targetDiv" class="character-target-div" :ref="targetDiv"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -63,6 +63,12 @@ export default {
|
|
|
methods: {
|
|
|
initHanziwrite() {
|
|
|
let _this = this;
|
|
|
+ if (this.$refs[this.targetDiv]) {
|
|
|
+ let svg_arr = this.$refs[this.targetDiv].querySelectorAll('svg');
|
|
|
+ svg_arr.forEach((item) => {
|
|
|
+ item.remove();
|
|
|
+ });
|
|
|
+ }
|
|
|
this.writer = HanziWriter.default.create(this.targetDiv, this.bookText, {
|
|
|
charDataLoader(char, onComplete) {
|
|
|
onComplete(_this.bookStrokes);
|