|
@@ -157,7 +157,11 @@ export default {
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
- watch: {},
|
|
|
|
|
|
+ watch: {
|
|
|
|
+ item(newVal, oldVal) {
|
|
|
|
+ this.this.initFn();
|
|
|
|
+ },
|
|
|
|
+ },
|
|
//方法集合
|
|
//方法集合
|
|
methods: {
|
|
methods: {
|
|
cancleColl() {
|
|
cancleColl() {
|
|
@@ -181,46 +185,49 @@ export default {
|
|
let _this = this;
|
|
let _this = this;
|
|
_this.curTime = curTime * 1000;
|
|
_this.curTime = curTime * 1000;
|
|
},
|
|
},
|
|
|
|
+ initFn() {
|
|
|
|
+ let _this = this;
|
|
|
|
+ if (_this.item) {
|
|
|
|
+ let dict = _this.item.new_word.definition_dictionary_json
|
|
|
|
+ ? JSON.parse(_this.item.new_word.definition_dictionary_json)
|
|
|
|
+ : null;
|
|
|
|
+ _this.dictDetail = dict.data;
|
|
|
|
+ let arr = [];
|
|
|
|
+ if (this.dictDetail && this.dictDetail.explains) {
|
|
|
|
+ this.dictDetail.explains.forEach((it) => {
|
|
|
|
+ let obj = {
|
|
|
|
+ part: it.substring(
|
|
|
|
+ 0,
|
|
|
|
+ it.indexOf(". ") > -1 &&
|
|
|
|
+ this.cixingList.indexOf(
|
|
|
|
+ it.substring(0, it.lastIndexOf(". ") + 1)
|
|
|
|
+ ) > -1
|
|
|
|
+ ? it.lastIndexOf(". ") + 2
|
|
|
|
+ : 0
|
|
|
|
+ ),
|
|
|
|
+ exp: it.substring(
|
|
|
|
+ it.indexOf(". ") > -1 &&
|
|
|
|
+ this.cixingList.indexOf(
|
|
|
|
+ it.substring(0, it.lastIndexOf(". ") + 1)
|
|
|
|
+ ) > -1
|
|
|
|
+ ? it.lastIndexOf(". ") + 2
|
|
|
|
+ : 0,
|
|
|
|
+ it.length
|
|
|
|
+ ),
|
|
|
|
+ };
|
|
|
|
+ arr.push(obj);
|
|
|
|
+ });
|
|
|
|
+ this.dictDetail.part = arr;
|
|
|
|
+ console.log(this.dictDetail);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
created() {},
|
|
created() {},
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
//生命周期 - 挂载完成(可以访问DOM元素)
|
|
mounted() {
|
|
mounted() {
|
|
- let _this = this;
|
|
|
|
- if (_this.item) {
|
|
|
|
- let dict = _this.item.new_word.definition_dictionary_json
|
|
|
|
- ? JSON.parse(_this.item.new_word.definition_dictionary_json)
|
|
|
|
- : null;
|
|
|
|
- _this.dictDetail = dict.data;
|
|
|
|
- let arr = [];
|
|
|
|
- if (this.dictDetail && this.dictDetail.explains) {
|
|
|
|
- this.dictDetail.explains.forEach((it) => {
|
|
|
|
- let obj = {
|
|
|
|
- part: it.substring(
|
|
|
|
- 0,
|
|
|
|
- it.indexOf(". ") > -1 &&
|
|
|
|
- this.cixingList.indexOf(
|
|
|
|
- it.substring(0, it.lastIndexOf(". ") + 1)
|
|
|
|
- ) > -1
|
|
|
|
- ? it.lastIndexOf(". ") + 2
|
|
|
|
- : 0
|
|
|
|
- ),
|
|
|
|
- exp: it.substring(
|
|
|
|
- it.indexOf(". ") > -1 &&
|
|
|
|
- this.cixingList.indexOf(
|
|
|
|
- it.substring(0, it.lastIndexOf(". ") + 1)
|
|
|
|
- ) > -1
|
|
|
|
- ? it.lastIndexOf(". ") + 2
|
|
|
|
- : 0,
|
|
|
|
- it.length
|
|
|
|
- ),
|
|
|
|
- };
|
|
|
|
- arr.push(obj);
|
|
|
|
- });
|
|
|
|
- this.dictDetail.part = arr;
|
|
|
|
- console.log(this.dictDetail);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ this.initFn();
|
|
},
|
|
},
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
beforeCreate() {}, //生命周期 - 创建之前
|
|
beforeMount() {}, //生命周期 - 挂载之前
|
|
beforeMount() {}, //生命周期 - 挂载之前
|