//export.js
// export class TaskCollection {
// constructor(tasks = []) {
// this.tasks = tasks
// }
// dump() {
// console.log(this.tasks);
// }
// }
// export let foo = 'bar';
// export default class TaskCollection {
// constructor(tasks = []) {
// this.tasks = tasks
// }
// dump() {
// console.log(this.tasks);
// }
// }
// export let foo = 'bar';
export default class TaskCollection {
constructor(tasks = []) {
this.tasks = tasks
}
dump() {
console.log(this.tasks);
}
}
//main.js
// import {TaskCollection, foo} from './TaskCollection';
// import TaskCollection, {foo} from './TaskCollection';
import TaskCollection from './TaskCollection';
new TaskCollection([
'one',
'two',
'three'
]).dump();
网友评论