Home > Article > Web Front-end > Detailed explanation of module syntax in JavaScript ES6
import
First type: import
Writing:
import { awaitAddGoodsList, goodsSkuList ,setSku} from '@/api/marketActivity'
Quote :
mounted(){ awaitAddGoodsList//直接使用 }
Second type: import
Writing:
import * as limitedBuy from '@/utils/limitedBuy'
Quote:
mounted(){ limitedBuy.demo(); }
export
The first way of writing:
.export function demo(){}
The second way of writing:
function demo() export {demo}
The third way can also be renamed
export {demo as demo1}这样import的时候就demo1
export default function(){}
import demo form 'xxx.js'
No need for braces
The above is the detailed content of Detailed explanation of module syntax in JavaScript ES6. For more information, please follow other related articles on the PHP Chinese website!