Created
September 1, 2019 16:16
-
-
Save korelstar/8d6fc42b8d69c2c84a70be298f39b451 to your computer and use it in GitHub Desktop.
demo for performance of https://github.com/nextcloud/nextcloud-vue/pull/486
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> | |
<Content app-name="vueexample"> | |
<AppNavigation> | |
<ul id="app-vueexample-navigation"> | |
<AppNavigationItem v-for="item in items" | |
:key="item" | |
:title="item" | |
@click="dummy"> | |
<template slot="actions"> | |
<ActionButton icon="icon-starred" @click="dummy"> | |
Favorit | |
</ActionButton> | |
<ActionButton icon="icon-files-dark" @click="dummy"> | |
Kategorie | |
</ActionButton> | |
<ActionButton icon="icon-delete" @click="dummy"> | |
Löschen | |
</ActionButton> | |
</template> | |
</AppNavigationItem> | |
</ul> | |
<AppNavigationSettings> | |
Example settings | |
</AppNavigationSettings> | |
</AppNavigation> | |
<AppContent> | |
<span>This is the content</span> | |
<button @click="longnav = !longnav"> | |
Toggle navigation | |
</button> | |
</AppContent> | |
</Content> | |
</template> | |
<script> | |
import { | |
Content, | |
ActionButton, | |
AppContent, | |
AppNavigation, | |
AppNavigationItem, | |
AppNavigationSettings | |
} from 'nextcloud-vue' | |
export default { | |
name: 'App', | |
components: { | |
Content, | |
ActionButton, | |
AppContent, | |
AppNavigation, | |
AppNavigationItem, | |
AppNavigationSettings | |
}, | |
data: function() { | |
return { | |
longnav: false | |
} | |
}, | |
computed: { | |
itemsLong: function() { | |
let items = [] | |
for (let i = 1; i <= 200; i++) { | |
items.push('Item ' + i) | |
} | |
return items | |
}, | |
items: function() { | |
return this.longnav ? this.itemsLong : [] | |
} | |
}, | |
beforeUpdate() { | |
console.debug('vue: beforeUpdate') | |
}, | |
updated() { | |
console.debug('vue: updated') | |
this.$nextTick(function() { | |
console.debug('vue: updated -> nextTick') | |
}) | |
}, | |
methods: { | |
dummy() { | |
console.debug('Action') | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment