This file contains hidden or 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
// Result should be: | |
`Doe, John & Doe, Jane & Smith, James` | |
``` | |
$array = [ | |
'first_name' => 'John', | |
'last_name' => 'Doe, | |
], | |
[ | |
'first_name' => 'James', |
This file contains hidden or 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
<script> | |
import SystemInformation from './LandingPage/SystemInformation' | |
export default { | |
name: 'landing-page', | |
components: { SystemInformation }, | |
data () { | |
return { | |
posts: [], | |
success: null |
This file contains hidden or 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
<script> | |
import SystemInformation from './LandingPage/SystemInformation' | |
export default { | |
name: 'landing-page', | |
components: { SystemInformation }, | |
data () { | |
return { | |
posts: [], | |
success: null |
This file contains hidden or 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
onDelete (id) { | |
this.posts.splice(id, 1) | |
localStorage.setItem('posts', JSON.stringify(this.posts)) | |
this.success = 'Successfully deleted the post!' // add this message | |
} |
This file contains hidden or 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
... | |
<p v-if="success" class="alert alert-success">{{success}}</p> | |
<h2>Posts <router-link to="/post" class="btn btn-sm btn-primary">Add a post</router-link></h2> | |
<div v-if="posts.length" class="table-responsive"> | |
... |
This file contains hidden or 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
... | |
data () { | |
return { | |
posts: [], | |
success: null // here | |
} | |
}, |
This file contains hidden or 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
methods: { | |
.... | |
onDelete (id) { | |
this.posts.splice(id, 1) | |
localStorage.setItem('posts', JSON.stringify(this.posts)) | |
} | |
} |
This file contains hidden or 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
<table class="table table-striped table-sm"> | |
<thead> | |
<tr> | |
<th>#</th> | |
<th>Title</th> | |
<th>Body</th> | |
<th></th> | |
</tr> | |
</thead> | |
<tbody> |
This file contains hidden or 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> | |
<div id="main"> | |
<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0"> | |
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="#">Electron CMS</a> | |
<input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search"> | |
<ul class="navbar-nav px-3"> | |
<li class="nav-item text-nowrap"> | |
<a class="nav-link" href="#">Sign out</a> | |
</li> | |
</ul> |
This file contains hidden or 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
import Vue from 'vue' | |
import Router from 'vue-router' | |
Vue.use(Router) | |
export default new Router({ | |
routes: [ | |
{ | |
path: '/', | |
name: 'landing-page', |