|
@@ -1,4 +1,3 @@
|
|
|
-<!-- -->
|
|
|
<template>
|
|
|
<div class="strockredBox">
|
|
|
<div class="strockred">
|
|
@@ -53,66 +52,50 @@ export default {
|
|
|
Book_text: {
|
|
|
handler(val, oldVal) {
|
|
|
if (val !== oldVal) {
|
|
|
- let _this = this;
|
|
|
- _this.$nextTick(() => {
|
|
|
- _this.initHanziwrite();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.initHanziwrite();
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- // 深度观察监听
|
|
|
deep: true,
|
|
|
},
|
|
|
},
|
|
|
- // 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
- created() {},
|
|
|
- // 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
mounted() {
|
|
|
- let _this = this;
|
|
|
- _this.$nextTick(() => {
|
|
|
- _this.initHanziwrite();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.initHanziwrite();
|
|
|
});
|
|
|
},
|
|
|
- beforeCreate() {}, // 生命周期 - 创建之前
|
|
|
- beforeMount() {}, // 生命周期 - 挂载之前
|
|
|
- beforeUpdate() {}, // 生命周期 - 更新之前
|
|
|
- updated() {}, // 生命周期 - 更新之后
|
|
|
- beforeDestroy() {}, // 生命周期 - 销毁之前
|
|
|
- destroyed() {}, // 生命周期 - 销毁完成
|
|
|
- activated() {},
|
|
|
// 方法集合
|
|
|
methods: {
|
|
|
initHanziwrite() {
|
|
|
- let _this = this;
|
|
|
let options = {
|
|
|
charDataLoader(char, onComplete) {
|
|
|
- onComplete(_this.bookStrokes);
|
|
|
+ onComplete(this.bookStrokes);
|
|
|
},
|
|
|
padding: 5,
|
|
|
showCharacter: false,
|
|
|
- strokeColor: _this.hanziColor,
|
|
|
- drawingColor: _this.hanziColor,
|
|
|
+ strokeColor: this.hanziColor,
|
|
|
+ drawingColor: this.hanziColor,
|
|
|
drawingWidth: 6,
|
|
|
};
|
|
|
- _this.writer = HanziWriter.default.create(_this.targetDiv, _this.Book_text, options);
|
|
|
- _this.writer.quiz();
|
|
|
+ this.writer = HanziWriter.default.create(this.targetDiv, this.Book_text, options);
|
|
|
+ this.writer.quiz();
|
|
|
},
|
|
|
resetHanzi() {
|
|
|
- let _this = this;
|
|
|
- _this.writer.quiz();
|
|
|
+ this.writer.quiz();
|
|
|
},
|
|
|
updateColor(color) {
|
|
|
- let _this = this;
|
|
|
- _this.writer.updateColor('strokeColor', color);
|
|
|
- _this.writer.updateColor('drawingColor', color);
|
|
|
+ this.writer.updateColor('strokeColor', color);
|
|
|
+ this.writer.updateColor('drawingColor', color);
|
|
|
},
|
|
|
- }, // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
-//@import url(); 引入公共css类
|
|
|
.strockredBox {
|
|
|
- width: 64px; //444px
|
|
|
- height: 64px; //480px
|
|
|
+ width: 64px; // 444px
|
|
|
+ height: 64px; // 480px
|
|
|
}
|
|
|
|
|
|
.strockred {
|