Skip to content

Instantly share code, notes, and snippets.

@korelstar
Created September 1, 2019 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korelstar/8d6fc42b8d69c2c84a70be298f39b451 to your computer and use it in GitHub Desktop.
Save korelstar/8d6fc42b8d69c2c84a70be298f39b451 to your computer and use it in GitHub Desktop.
<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