Last active
January 12, 2018 00:57
-
-
Save darrenjennings/2a726fce150831acbe2a8d1d6d2bf3d5 to your computer and use it in GitHub Desktop.
Vue Render Prop - Parent
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
<template> | |
<div id="app"> | |
<Mouse :render="__render"/> | |
</div> | |
</template> | |
<script> | |
import Mouse from "./Mouse.js"; | |
export default { | |
name: "app", | |
components: { | |
Mouse | |
}, | |
methods: { | |
__render({ x, y }) { | |
return ( | |
<h1> | |
The mouse position is ({x}, {y}) | |
</h1> | |
); | |
} | |
} | |
}; | |
</script> | |
<style> | |
* { | |
margin: 0; | |
height: 100%; | |
width: 100%; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment