-
exportとexport default
-
export defaultを使う
-
複数のモジュールをexportするときはexportを使う
-
理由
-
ECMAScript 6 favors the single/default export style, and gives the sweetest syntax to importing the default. I
-
簡潔になるよ
-
-
export
-
import * as utils from ‘./utils’;
-
import { method1, method2 } from ‘./utils’;
-
-
export default
-
//—— myFunc.js ——
-
export default function () { … };
-
//—— main1.js ——
-
import myFunc from ‘myFunc’;
-
myFunc();
-
-
//—— MyClass.js ——
-
export default class { … };
-
//—— main2.js ——
-
import MyClass from ‘MyClass’;
-
let inst = new MyClass();
-
-
-
-
exports.method1 = function() {}で書いていたもの
-
export default class Utils {
-
static method1() {}
-
static method2() {}
-
}
-
exportとexport default
- 2019年4月29日
- 2020年3月12日
- Javascript, Nuxt
- javascript
Fatal error: Uncaught Error: Call to undefined function set_post_views() in /home/jszk/desnote.com/public_html/wpjs/wp-content/themes/the-thor-child/single.php:658 Stack trace: #0 /home/jszk/desnote.com/public_html/wpjs/wp-includes/template-loader.php(78): include() #1 /home/jszk/desnote.com/public_html/wpjs/wp-blog-header.php(19): require_once('/home/jszk/desn...') #2 /home/jszk/desnote.com/public_html/index.php(17): require('/home/jszk/desn...') #3 {main} thrown in /home/jszk/desnote.com/public_html/wpjs/wp-content/themes/the-thor-child/single.php on line 658