码迷,mamicode.com
首页 > 其他好文 > 详细

Vue 中 export default 和 module.exports

时间:2017-04-18 16:03:50      阅读:755      评论:0      收藏:0      [点我收藏+]

标签:common   module   mod   imp   网络   ports   编译   文件   nbsp   

export default 服从 ES6 的规范,补充:default 其实是别名

module.exports 服从CommonJS 规范

 

一般导出一个属性或者对象用 export default 

一般导出模块或者说文件使用 module.exports

 

以上来自网络,不一定准确,有待进一步确认。

 

附带:

import from 服从ES6规范,在编译器生效

require 服从ES5 规范,在运行期生效

目前 vue 编译都是依赖label 插件,最终都转化为ES5.

Vue 中 export default 和 module.exports

标签:common   module   mod   imp   网络   ports   编译   文件   nbsp   

原文地址:http://www.cnblogs.com/yako/p/6727889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!