es6模块
<script type="module"> // 引渠模块export.js import student from "./export.js"; console.log(student) console.log(student.getInfo()) </script>
模块export.js
export default{ name:"jack", age:11, getInfo(){ return `姓名:${this.name},年龄:${this.age}` } }
<script type="module"> // 引渠模块export.js import student from "./export.js"; console.log(student) console.log(student.getInfo()) </script>
模块export.js
export default{ name:"jack", age:11, getInfo(){ return `姓名:${this.name},年龄:${this.age}` } }