Last active
November 18, 2016 17:59
-
-
Save patrickodacre/4dc87667b5fb449b2b143a185d4c66d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// export iife | |
export default (() => { | |
const options = { | |
name : 'UserList', | |
data, | |
methods: { | |
getUsers | |
} | |
} | |
return options | |
function data () { | |
return { users: [] } | |
} | |
function getUsers () { | |
return axios.get('someUrl') | |
.then((resp)=> { | |
this.users = resp.data | |
}) | |
} | |
})() | |
// vs export options obj no iife | |
const options = { | |
name : 'UserList', | |
data, | |
methods: { | |
getUsers | |
} | |
} | |
function data () { | |
return { users: [] } | |
} | |
function getUsers () { | |
return axios.get('someUrl') | |
.then((resp)=> { | |
this.users = resp.data | |
}) | |
} | |
export {options as default} | |
// vs format in docs: | |
export default { | |
name : 'UserList', | |
data () { | |
return { users: [] } | |
}, | |
methods: { | |
getUsers () { | |
return axios.get('someUrl') | |
.then((resp)=> { | |
this.users = resp.data | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment