|
@@ -16,27 +16,14 @@
|
|
|
v-if="playStorkes"
|
|
|
></div> -->
|
|
|
<template v-if="Book_text != '〇'">
|
|
|
- <div
|
|
|
- :id="targetDivGray"
|
|
|
- class="character-target-div character-target-div-gray"
|
|
|
- ></div>
|
|
|
+ <div :id="targetDivGray" class="character-target-div character-target-div-gray"></div>
|
|
|
<div :id="targetDiv" class="character-target-div"></div>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
<span class="book-text">{{ Book_text }}</span>
|
|
|
</template>
|
|
|
- <svg-icon
|
|
|
- icon-class="tian"
|
|
|
- className="tian-bg"
|
|
|
- v-if="BoxbgType == 0"
|
|
|
- :style="{ color: '#DEDEDE' }"
|
|
|
- />
|
|
|
- <svg-icon
|
|
|
- icon-class="mi"
|
|
|
- className="tian-bg"
|
|
|
- v-if="BoxbgType == 1"
|
|
|
- :style="{ color: '#DEDEDE' }"
|
|
|
- />
|
|
|
+ <svg-icon icon-class="tian" className="tian-bg" v-if="BoxbgType == 0" :style="{ color: '#DEDEDE' }" />
|
|
|
+ <svg-icon icon-class="mi" className="tian-bg" v-if="BoxbgType == 1" :style="{ color: '#DEDEDE' }" />
|
|
|
<!-- <svg-icon
|
|
|
icon-class="tian"
|
|
|
:className="tianColor ? 'tian-bg-red' : 'tian-bg'"
|
|
@@ -45,21 +32,21 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getContentFile } from "@/api/api";
|
|
|
-const HanziWriter = require("hanzi-writer");
|
|
|
+import { getContentFile } from '@/api/api';
|
|
|
+const HanziWriter = require('hanzi-writer');
|
|
|
export default {
|
|
|
- name: "Strockplayredline",
|
|
|
+ name: 'Strockplayredline',
|
|
|
components: {},
|
|
|
props: [
|
|
|
- "targetDiv",
|
|
|
- "Book_text",
|
|
|
- "playStorkes",
|
|
|
- "strokeColor",
|
|
|
- "strokeColorgray",
|
|
|
- "curItem",
|
|
|
- "strokeNumber",
|
|
|
- "targetDivGray",
|
|
|
- "BoxbgType",
|
|
|
+ 'targetDiv',
|
|
|
+ 'Book_text',
|
|
|
+ 'playStorkes',
|
|
|
+ 'strokeColor',
|
|
|
+ 'strokeColorgray',
|
|
|
+ 'curItem',
|
|
|
+ 'strokeNumber',
|
|
|
+ 'targetDivGray',
|
|
|
+ 'BoxbgType',
|
|
|
],
|
|
|
data() {
|
|
|
return {
|
|
@@ -80,6 +67,18 @@ export default {
|
|
|
// 深度观察监听
|
|
|
deep: true,
|
|
|
},
|
|
|
+ strokeColor: {
|
|
|
+ handler: function (val, oldVal) {
|
|
|
+ if (val != oldVal) {
|
|
|
+ let _this = this;
|
|
|
+ _this.$nextTick(() => {
|
|
|
+ _this.initHanziwrite();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 深度观察监听
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
},
|
|
|
//方法集合
|
|
|
methods: {
|
|
@@ -91,34 +90,26 @@ export default {
|
|
|
noe2.removeChild(noe2.children[0]);
|
|
|
node.removeChild(node.children[0]);
|
|
|
}
|
|
|
- if (_this.Book_text == "〇") return false;
|
|
|
+ if (_this.Book_text == '〇') return false;
|
|
|
_this.writer = null;
|
|
|
//var ren = require("hanzi-writer-data/国");
|
|
|
- _this.writer = HanziWriter.default.create(
|
|
|
- _this.targetDiv,
|
|
|
- _this.Book_text,
|
|
|
- {
|
|
|
- padding: 5,
|
|
|
- showOutline: true,
|
|
|
- strokeColor: _this.strokeColor,
|
|
|
- charDataLoader: function (char, onComplete) {
|
|
|
- let charData = _this.handleData(Number(_this.strokeNumber));
|
|
|
- onComplete(charData);
|
|
|
- },
|
|
|
- }
|
|
|
- );
|
|
|
- _this.writer = HanziWriter.default.create(
|
|
|
- _this.targetDivGray,
|
|
|
- _this.Book_text,
|
|
|
- {
|
|
|
- padding: 5,
|
|
|
- showOutline: true,
|
|
|
- strokeColor: _this.strokeColorgray,
|
|
|
- charDataLoader: function (char, onComplete) {
|
|
|
- onComplete(JSON.parse(JSON.stringify(_this.curItem)));
|
|
|
- },
|
|
|
- }
|
|
|
- );
|
|
|
+ _this.writer = HanziWriter.default.create(_this.targetDiv, _this.Book_text, {
|
|
|
+ padding: 5,
|
|
|
+ showOutline: true,
|
|
|
+ strokeColor: _this.strokeColor,
|
|
|
+ charDataLoader: function (char, onComplete) {
|
|
|
+ let charData = _this.handleData(Number(_this.strokeNumber));
|
|
|
+ onComplete(charData);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ _this.writer = HanziWriter.default.create(_this.targetDivGray, _this.Book_text, {
|
|
|
+ padding: 5,
|
|
|
+ showOutline: true,
|
|
|
+ strokeColor: _this.strokeColorgray,
|
|
|
+ charDataLoader: function (char, onComplete) {
|
|
|
+ onComplete(JSON.parse(JSON.stringify(_this.curItem)));
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
handleData(stroke_num) {
|
|
|
if (this.curItem) {
|
|
@@ -156,7 +147,7 @@ export default {
|
|
|
activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
};
|
|
|
</script>
|
|
|
-<style lang='scss' scoped>
|
|
|
+<style lang="scss" scoped>
|
|
|
//@import url(); 引入公共css类
|
|
|
// @import "../common.scss";
|
|
|
.strockplayRedInner {
|
|
@@ -195,4 +186,4 @@ export default {
|
|
|
text-align: center;
|
|
|
line-height: 128px;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|