Skip to content

Instantly share code, notes, and snippets.

@nolimits4web
Last active July 26, 2018 10:18
Show Gist options
  • Save nolimits4web/343cd554e8ca1c575ea4cc64739800e2 to your computer and use it in GitHub Desktop.
Save nolimits4web/343cd554e8ca1c575ea4cc64739800e2 to your computer and use it in GitHub Desktop.
Framework7 router component template literal
<!-- new "es" attribute to treat it as template literal -->
<template es>
<div class="page">
<div class="navbar">
<div class="navbar-inner">
<div class="title">Profile</div>
</div>
</div>
<div class="page-content">
<!-- use conditional (ternary) operator instead of if/else -->
${this.user ? `
<!-- Show user list when it is loaded -->
<div class="list simple-list">
<ul>
<li>First Name: ${this.user.firstName}</li>
<li>Last Name: ${this.user.lastName}</li>
<li>Age: ${this.user.age}</li>
</ul>
</div>
` : `
<!-- Otherwise show preloader -->
<div class="block block-strong text-align-center">
<div class="preloader"></div>
</div>
`
}
</div>
</div>
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment