Browse Source

funktionierender Router hinzugefügt

pull/1/head
Edwina Barbalan 6 years ago
parent
commit
4cf54df7e7
2 changed files with 72 additions and 99 deletions
  1. 48
    65
      public/home.js
  2. 24
    34
      public/index.html

+ 48
- 65
public/home.js View File

@@ -1,72 +1,55 @@
Vue.component('Home', {
template: `<div id="message-list">
<div class="om-card card">
_messages = [
{
id: 1,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bme #semester',
user: 'user_1'
},
{
id: 2,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
tag: '#efi #fachschaft',
user: 'user_2'
},
{
id: 3,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bei #wichtig',
user: 'user_3'
},
];


Vue.component('MsgCard', {
template: `<div class="om-card card">
<h6 class="msg-head">
<b>{{ subject }}</b>
<b>{{ msg.subject }}</b>
<img src="favicon.ico" width=20px height=20px>
</h6>
{{ message }}<br><br>
<a href="#">{{ tag }}</a></p>
{{ msg.message }}<br><br>
<a href="#">{{ msg.tag }}</a></p>
<div class="om-user-line">
<i class="material-icons">account_circle</i>
Erstellt von {{ user }}
</div></div></div>`,
props: ['subject', 'message', 'tag', 'user']
})
Erstellt von {{ msg.user }}
</div></div>`,
props: ['msg']
});

new Vue({
el: '#message-list',
data: {
messages: [
{
id: 1,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bme #semester',
user: 'user_1'
},
{
id: 2,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
tag: '#efi #fachschaft',
user: 'user_2'
},
{
id: 3,
subject: 'Betreff',
message: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam.',
tag: '#efi #bei #wichtig',
user: 'user_3'
}
],
const HomeRouter = {
template: `
<div>
<MsgCard
v-for="(msg, index) in messages"
:key="msg.id"
:msg="msg"
></MsgCard>
</div>`,
data: function () {
return { messages: _messages };
},
})


/* First try of vue-componetn -> does not work
Vue.component('home', {
data: function () {
return {
}
},
template:
`<div id="sample">
<div v-for="msgs in private.messages">
<div class="om-card card" v-for="elements in msgs.message">
<h6 class="msg-head">
<b>{{elements.subject}}</b>
<img src="favicon.ico" width=20px height=20px>
</h6>
<p>{{elements.msg}}<br>
<a href="#">{{elements.tags}}</a></p>
<div class="om-user-line">
<i class="material-icons">account_circle</i>
Erstellt von {{elements.user}}
</div>
</div>
</div>
</div>`
})

*/
methods: {
},
};

+ 24
- 34
public/index.html View File

@@ -17,12 +17,18 @@
<link rel="stylesheet" href="https://unpkg.com/bootstrap-material-design@4.1.1/dist/css/bootstrap-material-design.min.css" integrity="sha384-wXznGJNEXNG1NFsbm0ugrLFMQPWswR3lds2VeinahP8N0zJw9VWSopbjv2x7WCvX" crossorigin="anonymous">

<!-- NOTE: VUE.js und VueRouter -->
<script src=lib/jquery-3.3.1.min.js></script>
<script src=lib/vue.js></script>
<script src=lib/vue-router.js></script>
<script src=lib/jquery-3.3.1.min.js></script>

<!-- CSS_Custom Design -->
<link rel="stylesheet" type="text/css" href="style.css">
<!-- NOTE: Call Vue Components -->
<script src="home.js"></script>
<!-- <script src="files.js"></script> -->
<script src="createMessage.js"></script>
<script src="bookmark.js"></script>
<script src="profil.js"></script>


<title>OMApp</title>
@@ -42,36 +48,26 @@


<div class="om-content">
<div id="message-list">
<Home
v-for="(msg, index) in messages"
:key="msg.id"
:subject="msg.subject"
:message="msg.message"
:tag="msg.tag"
:user="msg.user"
></Home>
</div>
</div>
<nav class="nav nav-tabs nav-justified om-nav ">
<router-link to="/home" class="nav-item nav-link"><i class="material-icons">home</i></router-link>
<router-link to="/files" class="nav-item nav-link"><i class="material-icons">folder</i></router-link>
<router-link to="/createMessage" class="nav-item nav-link outlined"><i class="material-icons">add_circle</i></router-link>
<router-link to="/bookmark" class="nav-item nav-link"><i class="material-icons">bookmark</i></router-link>
<router-link to="/profil" class="nav-item nav-link"><i class="material-icons">person</i></router-link>
</nav>
<router-view></router-view>
</div>
<!--<router-view></router-view> -->
<!--
<script>
<nav class="nav nav-tabs nav-justified om-nav ">
<router-link to="/home" class="nav-item nav-link"><i class="material-icons">home</i></router-link>
<router-link to="/files" class="nav-item nav-link"><i class="material-icons">folder</i></router-link>
<router-link to="/createMessage" class="nav-item nav-link outlined"><i class="material-icons">add_circle</i></router-link>
<router-link to="/bookmark" class="nav-item nav-link"><i class="material-icons">bookmark</i></router-link>
<router-link to="/profil" class="nav-item nav-link"><i class="material-icons">person</i></router-link>
</nav>
</div>

<script>

const routes = [
{ path: "/home", component: Home },
{ path: "/files", component: Files },
{ path: "/", component: HomeRouter },
{ path: "/home", component: HomeRouter },
/* { path: "/files", component: Files },
{ path: "/createMessage", component: CreateMsg },
{ path: "/bookmark", component: Bookmark },
{ path: "/profil", component: Profil },
{ path: "/profil", component: Profil },*/
];
const router = new VueRouter({
routes
@@ -82,20 +78,14 @@
});

</script>
-->
<!-- NOTE: JavaScript Libs & Files -->
<!-- NOTE: Call Vue Components -->
<script src="home.js"></script>
<!-- <script src="files.js"></script> -->
<script src="createMessage.js"></script>
<script src="bookmark.js"></script>
<script src="profil.js"></script>
<!-- CDN_Vue.js developmement lib -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>
<!--<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>-->
<!-- CDN_Vue.js minified lib -->
<!-- <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script> -->
<!-- CDN_jQuery minified lib -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<!--<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>-->
<!-- CDN_Popper.js lib -->
<script src="https://unpkg.com/popper.js@1.12.6/dist/umd/popper.js" integrity="sha384-fA23ZRQ3G/J53mElWqVJEGJzU0sTs+SvzG8fXVWP+kJQ1lwFAOkcUOysnlKJC33U" crossorigin="anonymous"></script>
<!-- CDN_Bootstrap JS lib -->

Loading…
Cancel
Save