Commit cef25ce9 by zhujunjie

修复点击树状重新渲染子组件

parent 1a576f26
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
:actions="actions || []" :actions="actions || []"
@clickAction="postCommand" @clickAction="postCommand"
/> />
<comment :thread-id="threadId" /> <comment v-if="renderComponent" ref="comment" :thread-id="threadId" />
</div> </div>
</div> </div>
</div> </div>
...@@ -80,7 +80,8 @@ import config from "@/config.js"; ...@@ -80,7 +80,8 @@ import config from "@/config.js";
export default { export default {
data() { data() {
return { return {
threadId: "1", threadId: "28",
renderComponent: true,
actions: [ actions: [
{ {
text: this.$t("topic.read"), text: this.$t("topic.read"),
...@@ -172,6 +173,12 @@ export default { ...@@ -172,6 +173,12 @@ export default {
// }; // };
}, },
methods: { methods: {
forceRerenders() {
this.renderComponent = false;
this.$nextTick(() => {
this.renderComponent = true;
});
},
deleteChildren(arr) { deleteChildren(arr) {
const childs = arr; const childs = arr;
for (let i = childs.length; i--; i > 0) { for (let i = childs.length; i--; i > 0) {
...@@ -190,6 +197,8 @@ export default { ...@@ -190,6 +197,8 @@ export default {
window.open(this.fileSrc, "_blank"); window.open(this.fileSrc, "_blank");
}, },
handleNodeClick(data) { handleNodeClick(data) {
this.threadId = "29"; // 目前写死
this.forceRerenders(); // 强制从新渲染函数
if (data.file) { if (data.file) {
this.showViewloading = true; this.showViewloading = true;
axios axios
...@@ -220,6 +229,7 @@ export default { ...@@ -220,6 +229,7 @@ export default {
} }
} }
this.fileMd5 = data.md5; this.fileMd5 = data.md5;
console.log(this.threadId, "我是父组件");
}); });
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment