Created
December 31, 2020 11:59
-
-
Save nolimits4web/194441a3eaaff7117cee5e6a6c259778 to your computer and use it in GitHub Desktop.
Framework7 v6 use store
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
<template> | |
<div class="page"> | |
<ul> | |
<!-- getter has value in ".value" property --> | |
${users.value.map((user) => $h` | |
<li>${user.name}</li> | |
`)} | |
</ul> | |
</div> | |
</template> | |
<script> | |
export default (props, { $store, $on }) => { | |
// retrieve "users" getter handler value. Initially empty array | |
const users = $store.getters('users'); | |
$on('pageInit', () => { | |
// load users on page init | |
store.dispatch('getUsers'); | |
}); | |
return $render; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment