Last active
July 20, 2020 12:56
-
-
Save Kaperskyguru/186a1ee7361da920cba75f2f522eb6a3 to your computer and use it in GitHub Desktop.
This file contains 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
<script> | |
import { mapGetters } from "vuex"; | |
import ErrorService from "../Services/ErrorService"; | |
export default { | |
name: "HelloWorld", | |
props: { | |
todo: Object, | |
}, | |
computed: { | |
...mapGetters(["getUser"]), | |
}, | |
methods: { | |
getUserName(id) { | |
const user = this.getUser(id); | |
if (user) return user.username; | |
}, | |
// Handling Errors in component | |
methodThrowsException() { | |
try { | |
// Do unexpected job | |
} catch (error) { | |
ErrorService.onError(error); | |
} | |
}, | |
}, | |
}; | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment