mio3io / cr-vue Goto Github PK
View Code? Open in Web Editor NEW基礎から学ぶ Vue.js サポートページ(※このリポジトリはサポートページ用のもので学習に使用するものではありません。このリポジトリを Fork しても何も使えません)
Home Page: https://cr-vue.mio3io.com/
基礎から学ぶ Vue.js サポートページ(※このリポジトリはサポートページ用のもので学習に使用するものではありません。このリポジトリを Fork しても何も使えません)
Home Page: https://cr-vue.mio3io.com/
68ページ目の
◆v-if条件による描画
で、最後2行の意味が理解できませんでした。
補足していただけるとうれしいです。
P111ページの複数選択のセレクトボックスですが、複数選択できないです。サポートページのDEMO画面と同じように表示されてはおるのですが、DEMO画面でも私の実行環境でも複数選択まではできません。
書籍上だと複数選択できるような記載(AとCを選択している)があるので、どこかおかしいのではと思っています。
サポートページ: https://cr-vue.mio3io.com/guide/chapter3.html#%E3%82%BB%E3%83%AC%E3%82%AF%E3%83%88%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9
お手数お掛け致しますが、よろしくお願いいたします。
サンプルを参考に実装してみたのですが、思ったように動かなかったので質問させてください。
slotを使い、子コンポーネントでv-forを実行し、その内容を親コンポーネントに持ってきて
最後に子コンポーネントに渡す処理ですが、どう書いても動きません。
<!-- HTML -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue.js</title>
</head>
<body>
<div id="app">
<comp-child-3>
<li slot-scope="child3">{{ child3.item }}</li>
</comp-child-3>
</div>
<script src="vue.js"></script>
<script src="main.js"></script>
</body>
</html>
/* JavaScript */
Vue.component('comp-child-3', {
template: '<ul class="comp-child-3"><slot v-for="item in list" v-bind:item="item"></slot></ul>'
})
var app = new Vue({
el: '#app',
data: {
list: [
{ item: '1', name: 'name1' },
{ item: '2', name: 'name2' },
{ item: '3', name: 'name3' }
]
}
})
from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
のようなエラーが出てますが解決できてません。。。
これに関する回答を見ても出ませんかaxiosに関する例題ってないでしょうか?
書籍とサポートページでstore
へのアクセス方法が異なり混乱を招くため
ソースコード読み込み→ベタ書きに変更する
#6
P.127の通りVueを編集しました。
P.126で「Loadashなどのライブラリを使用」することが触れられていますが読み込み方法が書いていなかったため表題のエラーが発生しました。
対策としてindex.htmlに以下のJSファイルを読み込むことで解決しました。
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
取り急ぎ報告まで
v-model の説明の流れで読んで行きますと
修飾子 .number の付加して、値が count に変わってしまっていて、main.js に書いてある message と整合性が取れてないのでエラーになります。
Vue CLI3のインストールについて質問です。
231ページとおまけ-vue-cli-バージョン3を見ています。
npm install -g @vue/cli
でインストール時に以下のエラーとワーニングが出てしまいました。
試しにsudo
でも実行してみたのですが、別のエラーがでてしまいました。
PCはMacで、npmのバージョンは6.5.0です。
解決方法を教えていただけないでしょうか。
$ npm install -g @vue/cli
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! "Error: EACCES: permission denied, access '/usr/local/lib/node_modules'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mira/.npm/_logs/2019-02-11T06_24_15_731Z-debug.log
$ sudo npm install -g @vue/cli
npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead
/usr/local/bin/vue -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js
> [email protected] install /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents
> node install
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/lib'
gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/mira/.node-gyp/11.9.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp'
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node" "--module_name=fse" "--module_path=/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64" "--napi_version=4" "--node_abi_napi=napi"
gyp ERR! cwd /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents
gyp ERR! node -v v11.9.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:978:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents
node-pre-gyp ERR! node -v v11.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64/fse.node --module_name=fse --module_path=/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/lib/binding/Release/node-v67-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@vue/cli/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
+ @vue/[email protected]
updated 1 package in 12.676s
どうぞよろしくお願いいたします。
https://gyazo.com/1c1c7dfcc6e9e352d3313852f67360b5
doUpdate(event)
メソッド内の
store.dispatch('doUpdate', event.target.value)
がそのまま写経したところ動作しなかったため、
this.$store.dispatch('doUpdate', event.target.value)
が正しいのかなと思います。
お手数ですがご確認お願い致します。
「 el: '#app',」を付加しないと想定した表示になりませんでした。
new Vue({
el: '#app',
data: {
valueA: 'これは子A',
valueB: 'これは子B'
}
})
何度もすみません、スロットについて教えてください。
スロットでできることは、普通のコンポーネントのpropsを使ってもできると思うのですが、どのような場合にスロットを使うのが良いのでしょうか。
P169の最初のパラグラフの説明が答えなのかのしれませんが、いまいち理解できず...。
よろしくお願いします。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.