navigation emits

This commit is contained in:
Bart van der Braak 2020-01-31 16:13:10 +01:00
parent 1269d3efc1
commit 50dffb273f
6 changed files with 60 additions and 12 deletions

View file

@ -21,7 +21,7 @@ export default {
MainContent, MainContent,
LeftNav, LeftNav,
TopNav, TopNav,
} },
} }
</script> </script>

View file

@ -0,0 +1,27 @@
<template>
<section>
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 my-2">
<h1 class="h3 text-uppercase">{{ }}</h1>
<div class="btn-toolbar mb-2 mb-md-0">
<div class="btn-group mr-2">
<button type="button" class="btn btn-sm btn-outline-secondary">Share</button>
<button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
</div>
<button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-calendar"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg>
This week
</button>
</div>
</div>
</section>
</template>
<script>
export default {
name: "ConfigSection"
}
</script>
<style scoped>
</style>

View file

@ -2,13 +2,13 @@
<nav class="bg-light sidebar"> <nav class="bg-light sidebar">
<div class="sidebar-sticky"> <div class="sidebar-sticky">
<ul class="nav flex-column mb-2"> <ul class="nav flex-column mb-2">
<NavItem v-for="link in links" :key="link.id" :title="link.title" :id="link.id" :icon_url="link.icon"/> <NavItem v-for="link in links" :key="link.id" :title="link.title" :id="link.id" :icon_url="link.icon" :component="'config-section'"/>
</ul> </ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted"> <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
<span>Slayer Masters</span> <span>Slayer Masters</span>
</h6> </h6>
<ul class="nav flex-column mb-2"> <ul class="nav flex-column mb-2">
<NavItem v-for="master in masters" :key="master.id" :title="master.name" :id="master.id" :icon_url="master.image"/> <NavItem v-for="master in masters" :key="master.id" :title="master.name" :id="master.id" :icon_url="master.image" :component="'table-section'"/>
</ul> </ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted"> <h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
<span>Other Links</span> <span>Other Links</span>
@ -40,7 +40,6 @@ export default {
], ],
masters: master_json.masters, masters: master_json.masters,
extraLinks: [ extraLinks: [
{ {
id: 101, id: 101,
icon: 'osrswiki.png', icon: 'osrswiki.png',

View file

@ -1,19 +1,24 @@
<template> <template>
<main role="main" class="ml-sm-auto col-lg-10 px-4"> <main role="main" class="ml-sm-auto col-lg-10 px-4">
<section-content></section-content> <component :is="currentComponent"></component>
</main> </main>
</template> </template>
<script> <script>
import SectionContent from "./TableSection"; import TableSection from "./TableSection";
import ConfigSection from "./ConfigSection";
export default { export default {
name: 'MainContent', name: 'MainContent',
components: { components: {
SectionContent, TableSection,
}, },
props: { props: {
headerText: String headerText: String,
} currentComponent: {
default: 'table-section',
},
},
} }
</script> </script>

View file

@ -1,5 +1,5 @@
<template> <template>
<li class="nav-item"> <li class="nav-item" @click="contentSwitch">
<a class="nav-link active" v-bind:class="{ active: isActive }" href="#"> <a class="nav-link active" v-bind:class="{ active: isActive }" href="#">
<img class="mx-2" v-if="icon_url" :src="require(`../assets/${icon_url}`)" width="42" height="42"> <img class="mx-2" v-if="icon_url" :src="require(`../assets/${icon_url}`)" width="42" height="42">
<span class="h6">{{ title }}</span> <span class="h6">{{ title }}</span>
@ -19,6 +19,13 @@ export default {
id: Number, id: Number,
icon_url: String, icon_url: String,
title: String, title: String,
component: String,
},
methods: {
contentSwitch() {
this.$emit('contentSwitch', this.component);
console.log('test')
}
} }
} }
</script> </script>

View file

@ -14,7 +14,7 @@
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<b-table striped hover :items="filtered_items"></b-table> <b-table striped hover :items="filtered_items" :fields="fields"></b-table>
</div> </div>
</section> </section>
</template> </template>
@ -28,6 +28,16 @@ export default {
}, },
data() { data() {
return { return {
fields: [
{
key: 'last_name',
sortable: true
},
{
key: 'first_name',
sortable: true
},
],
total_weight: 100, total_weight: 100,
items: [ items: [
{ age_requirement: 40, first_name: 'Dickerson', last_name: 'Macdonald', combat_requirement: 10 }, { age_requirement: 40, first_name: 'Dickerson', last_name: 'Macdonald', combat_requirement: 10 },
@ -47,7 +57,7 @@ export default {
// this.filtered_items = this.items.filter(item => item.last_name.includes('Carney')); // this.filtered_items = this.items.filter(item => item.last_name.includes('Carney'));
this.filtered_items = this.items.filter(item => item.combat_requirement < this.filters.combat_level); this.filtered_items = this.items.filter(item => item.combat_requirement < this.filters.combat_level);
console.log(this.filtered_items)
}, },
}, },
mounted() { mounted() {