标签:export block OLE hello obj 函数 ack xxx port
知识点1: 箭头函数
function myConsole1 () {
console.log(666)
}
let myConsole2 = function () {
console.log(777)
}
// 箭头函数
let myConsole3 = () => {
console.log(888)
}
// 箭头函数,函数体只有一行时可以省略{}
let myConsole4 = () => console.log(999)
export {myConsole1, myConsole2, myConsole3, myConsole4}
let myConsole1 = function (value) {
console.log(value)
}
// 箭头函数
let myConsole2 = (value) => {
console.log(value)
}
export {myConsole1, myConsole2}
let myCount1 = function (num1, num2) {
let count = num1 + num2
console.log(count)
}
// 箭头函数
let myCount2 = (num1, num2) => {
let count = num1 + num2
console.log(count)
}
export {myCount1, myCount2}
hello.js
function obj1 () {
return ({name: 'Jack1', age: 31})
}
let obj2 = function () {
return ({name: 'Jack2', age: 32})
}
// 箭头函数
let obj3 = xxx => {
return ({name: 'Jack3', age: 33})
}
export {obj1, obj2, obj3}
hello.vue
import {obj1, obj2, obj3} from '../../util/es6Test/hello'
export default {
mounted () {
console.log(obj1().name, obj1().age)
console.log(obj2().name, obj2().age)
console.log(obj3().name, obj3().age)
}
}
标签:export block OLE hello obj 函数 ack xxx port
原文地址:https://www.cnblogs.com/bobi1234/p/10708326.html