This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
{{ storeCount }} | |
{{ localCount }} | |
{{ totalCount }} | |
<input type="button" @click="storeCountIncrement" value="increment"> | |
</div> | |
</template> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 波括弧をつけないとデフォルトエクスポートがインポートされる | |
import Hoge from "./sample_2.js"; | |
console.log( Hoge ); //default exports | |
// defaultキーワードの別名としてインポート | |
import { default as Fuga }from "./sample_2.js"; | |
console.log( Fuga ); //default exports | |
// 名前付きと同時にimport | |
import { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var asyncFunc = async function () { | |
return 1; | |
} | |
asyncFunc().then( v => console.log(v)); | |
// 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var promise = new Promise(function(resolve, reject) { | |
setTimeout(function() { | |
resolve(0); | |
}, 300); | |
}); | |
promise | |
.then( value =>{ | |
console.log(value); | |
// コールバック関数内でreturnすることで、値を後続の処理に引き渡せる。 |