Skip to content

Instantly share code, notes, and snippets.

View smokeyfro's full-sized avatar

Chris Rault smokeyfro

View GitHub Profile
@smokeyfro
smokeyfro / YourPage.vue
Last active January 21, 2021 09:21
Group posts by date with method & computed property
<template>
<Layout>
<h1>Group by Year via computed</h1>
<ul>
<li v-for="(items, year) in groupedByYear" :key="year">
{{ year }}
<ul>
<li v-for="item in items" :key="item.id">
@smokeyfro
smokeyfro / YourPage.vue
Last active January 21, 2021 09:20
Group posts by category with method & computed property
<template>
<Layout>
<h1>Group by Category via computed</h1>
<ul>
<li v-for="(items, category) in groupedByCategory" :key="category">
{{ category }}
<ul>
<li v-for="item in items" :key="item.id">
{{ item.title }}
</li>
@smokeyfro
smokeyfro / YourPage.vue
Created January 21, 2021 09:22
Group posts by year with method only
<template>
<Layout>
<h1>Group by Year via method</h1>
<ul>
<li v-for="(items, year) in groupBy($page.allBlogPost.edges, 'createdYear')" :key="year">
{{ year }}
<ul>
<li v-for="item in items" :key="item.id">
{{ item.title }}
</li>
<template>
<header class="p-10">
<div class="md:flex md:justify-between md:items-center">
<a href="/" title="" class="block hover:opacity-60">
<!-- <img :src="fileUrl(global.seo_image.id)" :alt="global.site_name" class="w-12" /> -->
</a>
<!-- <pre>{{global.navigation[0]}}</pre> -->
<!-- <ul v-if>
<li v-for="(item,index) in global.navigation" :key="index">
{{ item.label.value }}
import { defineStore } from 'pinia';
export const useAssignmentsStore = defineStore('assignments', {
state: () => ( {
assignments: {},
}),
actions: {
async fetchAssignments() {
const user = useDirectusUser()
const { getItems } = useDirectusItems()