Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jason challenge #3

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Eventlessdrop
Copy link

申し訳ありませんどうなったとわかんないけどこれ大丈夫ですか?

I would like to sincerely apologize for the inconvenience caused, I was not aware that the pull request had closed

Comment on lines +39 to +41
this.answer1 = this.$route.params.answer1
this.answer2 = this.$route.params.answer2
this.answer3 = this.$route.params.answer3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answer は、vuexのstateで管理すると良いかと思います

nuxt のドキュメントを貼っておきます
https://nuxtjs.org/guide/vuex-store

Comment on lines 51 to 58
if (this.potentialResult[i].result1 === this.answer1) {
if (this.potentialResult[i].result2 === this.answer2) {
if (this.potentialResult[i].result3 === this.answer3) {
this.final = this.potentialResult[i]
}
}
}
}
Copy link
Contributor

@ko-hioki ko-hioki Nov 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if文の階層が深くなり、わかりにくくなっているので下記のよう書くこともできます

if (this.potentialResult[i].result1 !== this.answer1) continue
if (this.potentialResult[i].result2 !== this.answer2) continue
if (this.potentialResult[i].result3 !== this.answer3) continue

this.final = this.potentialResult[i]
break

// this.openGraph()
},
methods: {
determineResult() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

判定のロジックは stateのActionで判定させて
pages/Answers/index.vue では結果のみを表示させたいですね

}
}
},
sharableresult() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここのシェアの判定もロジックは stateのActionで判定させて
pages/Answers/index.vue では結果のみを表示させたいですね

.city-image{
max-width: 1000px;
max-height: 600px;
/*background-image: url('~assets/kamakura.jpg');*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらのコメントは今後使用しますでしょうか?

使用していないコメントなどはレビュー前に消しておくと良いですよ

</h1>
<div class="button-container">
<button class="quiz-button">
<nuxt-link class="button-label" :to="{name: 'Questions-Two', params: { answer1: 'Yes' }}">
Copy link
Contributor

@ko-hioki ko-hioki Nov 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

質問の回答はパラメーターを渡すのではなく、vuexのstateに入れて管理してみましょう

Comment on lines +45 to +47
margin-right: 43vw;
margin-left: 5vw;
margin-bottom: 30vh;
Copy link
Contributor

@ko-hioki ko-hioki Nov 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

margin: auto 5vw 30vh 43vw; と書けます
細かな指定は vh や vwではなく pxなどで指定したほうが良さそうですね

また表示位置などでしたら、Positionでも指定可能です

Comment on lines +71 to +72
margin-left: 5vh;
margin-right: 5vh;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

margin: auto 5vh; と書けます

@@ -0,0 +1,46 @@
<template>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちらのファイル(components/Header.vue)は今回の課題で使用していますか?

if (this.potentialResult[i].result3 !== this.answer3) continue

this.final = this.potentialResult[i]
break
Copy link
Contributor

@ko-hioki ko-hioki Nov 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コードがスッキリわかりやすくなったと思います 👍

id: this.$route.params.id
}
},
computed: {
Copy link
Contributor

@ko-hioki ko-hioki Nov 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ストアの値を呼び出すときは
vuex で mapStateなどのHelperが用意されているのでこちらを使うと良いでしょう
https://vuex.vuejs.org/guide/state.html

export default {
components: {
Question: Question
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

export const getters = {}
export const mutations = {
increment(state) {
if (state.count < 4) {
Copy link
Contributor

@ko-hioki ko-hioki Nov 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mutations はstateに値を設定だけの役割なので、分岐などはActionsでチェックを行い、commitする使用し行うと良いかと思います

state.count++
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今回Storeで管理したいものは下記のものなので、
store/answers.js と store/questions.js は一つにまとまっている方が扱いやすいと思います

  • 回答の進捗
  • 回答結果

const correctAnswers = answers.filter(answer => answer)
return correctAnswers / state.questions.length
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants