tag:crieit.net,2005:https://crieit.net/boards/qa-vue-js/feed
「Vue.jsの質問をしたり答えたりする掲示板」の投稿 - Crieit
Crieitで「Vue.jsの質問をしたり答えたりする掲示板」ボードに投稿された最近の投稿
2023-12-19T10:39:17+09:00
https://crieit.net/boards/qa-vue-js/feed
tag:crieit.net,2005:PublicArticle/395040413a19cb4b3dc2a2e3856cb2c9
2023-12-19T10:39:17+09:00
2023-12-19T10:39:17+09:00
https://crieit.net/boards/qa-vue-js/395040413a19cb4b3dc2a2e3856cb2c9
Vueについて学び始めたばかりの初心者です。FireBaseとの連携について学んでいるところな...
<p>Vueについて学び始めたばかりの初心者です。<br />
FireBaseとの連携について学んでいるところなのですが、教材の通りに進めるとエラーが出てしまうので、よろしければご教授下さい</p>
<p>srcフォルダにfirbase/firebase.js というフォルダとファイルを作成</p>
<p>// Import the functions you need from the SDKs you need<br />
import { initializeApp } from "firebase/app";<br />
import { getFirestore } from "firebase/firestore";<br />
import 'firebase/auth';<br />
import "firebase/storage";</p>
<p>// TODO: Add SDKs for Firebase products that you want to use<br />
// https://firebase.google.com/docs/web/setup#available-libraries</p>
<p>// Your web app's Firebase configuration<br />
const firebaseConfig = {<br />
apiKey: "<strong>"<br />
authDomain: "</strong>",<br />
projectId: "<strong>",<br />
storageBucket: "</strong>",<br />
messagingSenderId: "<strong>",<br />
appId: "</strong>",<br />
};<br />
// Initialize Firebase<br />
const app = initializeApp(firebaseConfig);<br />
// Initialize Cloud Firestore and get a reference to the service<br />
const db = getFirestore(app);</p>
<p>export default db;</p>
<p>これを掲示板の画面を作成しているChatBorad.vueにて、</p>
<p><</p>
<p>script><br />
import firebase from "../firebase/firebase.js"</p>
<p>export default {<br />
created(){<br />
const chatRef = firebase.firestore().collection('ChatData')<br />
console.log(chatRef)<br />
},<br />
(以下略)</p>
<p>として画面遷移時に読み込みを行いたいのですが、実行すると<br />
【_firebase_firebase_js__WEBPACK_IMPORTED_MODULE_0__.default.firestore is not a function】<br />
としてエラーになってしまいます。</p>
<p>お分かりになる方、よろしければご教授お願い致します。</p>
Anonymous
tag:crieit.net,2005:PublicArticle/5f45fa21ab585575ed00e2b73f0ebda6
2021-03-19T21:46:37+09:00
2021-03-19T21:46:37+09:00
https://crieit.net/boards/qa-vue-js/5f45fa21ab585575ed00e2b73f0ebda6
・$emitの前についているthisは何を表しているのでしょうか? <my-input...
<p>・$emitの前についているthisは何を表しているのでしょうか?</p>
<pre><code> <my-input step="1"></my-input>
</code></pre>
<p>Vue.js</p>
<pre><code><br />Vue.component('my-input', {
props:["step"],
template:`<button type="button" @click="onclick"><span>{</span><span>{</span> step <span>}</span><span>}</span> </button>
`,
methods: {
onclick:function() {
this.$emit('plus', Number(his.step));
}
}
});
</code></pre>
Anonymous
tag:crieit.net,2005:PublicArticle/ffda017ef5c745695814a4e891746741
2019-04-26T15:09:17+09:00
2019-04-26T15:10:58+09:00
https://crieit.net/boards/qa-vue-js/ffda017ef5c745695814a4e891746741
すみません、一人で考えてたら煮詰まってしまって...単に自分の混乱を吐露するようなご質問ですの...
<p>すみません、一人で考えてたら煮詰まってしまって...<br />
単に自分の混乱を吐露するようなご質問ですので、基本的に無視していただいても仕方ないと思うのですが、もし本件に一家言お持ちの方がいらっしゃいましたらご意見をお聞かせいただければ本当にありがたいです</p>
<p>Vue で View の コンポーネントを作る時、かつコンポーネントが外部の大きな定義ファイルを(たとえば 809種類のポケモンデータの json とか)元に表示をするとき、<strong>以下のどちらが技術的にみて適切</strong>なのでしょうか</p>
<ul>
<li><p>module.exports は read only なので、インポートしたした pokemon 情報を含めない、だから <strong>export に変更すべき</strong><br />
<a href="https://crieit.now.sh/upload_images/cf91ce6356839d2526eb9b4c52c0fd7d5cc29d93b3d8e.png" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/cf91ce6356839d2526eb9b4c52c0fd7d5cc29d93b3d8e.png?mw=700" alt="スクリーンショット 2019-04-26 14.44.48.png" /></a></p></li>
<li><p>vue-cli が「これがベスト・プラクティスだ」って言ってコンポーネントを module.exports にしてるんだから、なんか理由はわからないけどテンプレートで import なんかすべきじゃない(教条主義的ではありますが)。router.js あたりでインポートして <strong>props として渡すべき</strong></p></li>
</ul>
<p>(ちなみに、下記ではそうしてた処理をコメントアウトしてやめちゃってますし、props で渡してた内容もすでに消しちゃってますが参考まで)</p>
<p><a href="https://crieit.now.sh/upload_images/5981100ff111c2d1da7f69e657f99d6a5cc29ff5cdb0a.png" target="_blank" rel="nofollow noopener"><img src="https://crieit.now.sh/upload_images/5981100ff111c2d1da7f69e657f99d6a5cc29ff5cdb0a.png?mw=700" alt="スクリーンショット 2019-04-26 15.06.13.png" /></a></p>
<p>3日考えてもなにも思いつかず闇の中にいるような気分です<br />
ググってもあまりピッタリな話はでてこないし、<br />
なんでもいいのでどなたかなにかご意見をおきかせいただければ大変ありがたい次第です</p>
Dr. Takeyuki Ueda