00.ionic4:11.緯度経度から歩いた距離を表示
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
00.ionic4:11.緯度経度から歩いた距離を表示 [2019/09/11] – [Vue.jsとsetInterval] adash333 | 00.ionic4:11.緯度経度から歩いた距離を表示 [2019/09/12] (現在) – [いまどきのJavaScript記法] adash333 | ||
---|---|---|---|
行 107: | 行 107: | ||
===== Vue.jsとsetInterval ===== | ===== Vue.jsとsetInterval ===== | ||
- | + | これからはじめるVue.js実践入門p37によると、setIntervalメソッドの配下では、thisは、Vueインスタンスではなく、グローバルオブジェクト(window)に変化してしまうため、あらかじめthatなどで固定しておく必要があるとのことです。 | |
- | setIntervalメソッドの配下では、thisは、Vueインスタンスではなく、グローバルオブジェクト(window)に変化してしまうため、あらかじめthatなどで固定しておく必要がある。 | + | |
< | < | ||
export default { | export default { | ||
+ | name: ' | ||
+ | data: { | ||
+ | // 現在日時 | ||
+ | current: new Date() | ||
+ | }, | ||
+ | // 起動時にタイマーを設定 | ||
+ | created: function() { | ||
+ | let that = this; | ||
+ | // 1000ミリ秒スパンでcurrentプロパティを更新 | ||
+ | this.timer = setInterval(function() { | ||
+ | that.current = new Date(); | ||
+ | }, 1000); | ||
+ | }, | ||
+ | // 終了時にタイマーを破棄 | ||
+ | beforeDestroy: | ||
+ | clearInterval(this.timer); | ||
+ | }, | ||
methods: { | methods: { | ||
| | ||
行 126: | 行 142: | ||
</ | </ | ||
+ | ===== Javascriptのthisについて ===== | ||
+ | https:// | ||
+ | thisって何?使い方を覚えて、JavaScriptをもっと楽しく使おう! | ||
+ | マサト | ||
+ | 2019/5/11 | ||
+ | |||
+ | https:// | ||
+ | @tsukishimaao | ||
+ | 2014年02月01日に更新 | ||
+ | windowオブジェクト | ||
+ | |||
+ | (引用ここから) | ||
+ | windowオブジェクトとはJavaScriptにあらかじめ用意されてるオブジェクトで、JavaScriptを何も書いてない状態でもwindowオブジェクトは利用する事が出来る。 | ||
+ | JavaScriptであらかじめ用意されている関数やオブジェクトは、みなwindowオブジェクトのプロパティです。HTMLデータを取得、操作する為の | ||
+ | window.document、URLなどの情報が格納されているwindow.locationなども、すべてwindowオブジェクトのプロパティです。 | ||
+ | (引用ここまで) | ||
+ | |||
+ | https:// | ||
+ | @takeharu | ||
+ | 2015年12月07日に更新 | ||
+ | JavaScriptの「this」は「4種類」?? | ||
+ | |||
+ | https:// | ||
+ | How to access the correct `this` inside a callback? | ||
+ | |||
+ | https:// | ||
+ | how to use setInterval in vue component | ||
+ | |||
+ | " | ||
+ | |||
+ | Using object methods as callbacks/ | ||
+ | what this refers to depends on how the function is called, not how it is defined. | ||
+ | そのため、解決策としては、 | ||
+ | -'' | ||
+ | -'' | ||
+ | -アロー関数を用いる | ||
+ | の3つがあるそうです。'' | ||
行 134: | 行 187: | ||
Written by Jonnie Hallman | Written by Jonnie Hallman | ||
@destroytoday | @destroytoday | ||
+ | |||
+ | ===== いまどきのJavaScript記法 ===== | ||
+ | |||
+ | https:// | ||
+ | @shibukawa | ||
+ | 2019年05月04日に更新 | ||
+ | イマドキのJavaScriptの書き方2018 | ||
+ | |||
+ | ===== Vue.jsでlocalStorage ===== | ||
+ | |||
+ | |||
+ | https:// | ||
+ | クライアントサイドストレージ | ||
+ | 最終更新日: | ||
+ | |||
+ | https:// | ||
+ | @ma7ma7pipipi | ||
+ | 2019年01月14日に投稿 | ||
+ | vue.js で json localstorage を使う | ||
+ | |||
+ | https:// | ||
+ | 2019年6月10日 | ||
+ | Vue.jsでinstallを使用せずにlocalStorageを使用する方法 | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
00.ionic4/11.緯度経度から歩いた距離を表示.1568174165.txt.gz · 最終更新: 2019/09/11 by adash333