Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
fix: (#270) 问题详情页点击回答者头像进入回答者主页
Browse files Browse the repository at this point in the history
  • Loading branch information
mutoe committed Jul 3, 2018
1 parent 6de3533 commit 06dd662
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
16 changes: 9 additions & 7 deletions src/components/avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
:class="styles"
class="m-flex-shrink0 m-flex-grow0 m-avatar-box"
@click.native.stop>
<img
v-if="avatar"
:src="avatar"
class="m-avatar-img"
<img
v-if="avatar"
:src="avatar"
class="m-avatar-img"
@error="handelError">
<i
v-if="icon"
:style="icon"
<i
v-if="icon"
:style="icon"
class="m-avatar-icon"/>
</router-link>
</template>
Expand All @@ -24,6 +24,8 @@ export default {
default: "def"
},
user: {
type: Object,
default: () => {},
required: true
}
},
Expand Down
17 changes: 11 additions & 6 deletions src/components/modules/question/QuestionAnswersItem.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<template>
<div
class="module-question-answers-item"
<div
class="module-question-answers-item"
@click="viewDetail">
<div :class="classNameBuilder('avatar')">
<div
:class="classNameBuilder('avatar')"
@click.stop="viewUser">
<module-user-avatar
:size="0.56"
:anonymity="anonymity"
:src="user.avatar"
:sex="user.sex"
/>
:sex="user.sex" />
</div>
<div :class="classNameBuilder('main')">
<h3 :class="classNameBuilder('main-header')">
{{ anonymity ? '匿名用户' : user.name }}
<template @click.stop="viewUser">{{ anonymity ? '匿名用户' : user.name }}</template>

This comment has been minimized.

Copy link
@mutoe

mutoe Jul 5, 2018

Author Contributor

.stop修饰符防止触发外层click事件

<span>{{ answer.created_at | time2tips }}</span>
</h3>
<div :class="classNameBuilder('main-body')">{{ answer.body | markdownText }}</div>
Expand Down Expand Up @@ -109,6 +110,10 @@ export default {
this.$router.push(
`/questions/${this.answer.question_id}/answers/${this.answer.id}`
);
},
viewUser() {
if (!this.user.id) return;
this.$router.push(`/users/${this.user.id}`);
}
}
};
Expand Down

0 comments on commit 06dd662

Please sign in to comment.