Creating New Posts
Learn how to add new posts to our project.
We'll cover the following...
We can use the setItem
method to set or update data in our store. We can also use this in our project to create a new blog post. This will involve creating a new form on the front end to create a new post.
Updating our projects page structure
Before we add this, our front-end pages can be restructured as follows:
Press + to interact
We will have a home page, a blog page, and a page to display a single post when clicked. These pages have been added to the following project:
<template> <div> <h3>Home page</h3> <p>Welcome to my blog</p> </div> </template>
Updated project pages
Run the code, and you will see a simple home page and blog page to display the posts.
pages/blog/index.vue
Lines 1–16: ...