Skip to main content

Get the Reddit app

Scan this QR code to download the app now
Or check it out in the app stores
r/vuejs icon
r/vuejs icon

r/vuejs

members
online

Community highlights


Job market being what it is… is putting all my eggs into the Vue basket a bad idea? Job market being what it is… is putting all my eggs into the Vue basket a bad idea?

Granted, the point is to learn programming so that I can easily swap between react/vue/whatever my job asks of me, but whilst I work a nondev job, I settled on Vue as my framework of choice for building my projects for both personal use, and to display on my portfolio.

I’ve learned React to the point where I’ve built basic CRUD apps with it, also in NextJS, and am waiting for the official Svelte5 launch before I jump back into catching up with that.

I imagine there’s more in Vue that I can transfer to React/Svelte, than there would be if I stuck with Svelte? I don’t mind React, but I find it tedious using it after working 9 hours and wanting to enjoy my studying. Sure if someone offered me a job using React, I’d snap your hand off for it.






Yes another headless cms posts!! Yes another headless cms posts!!

So for work I use vue 3 and .net for my backend as a full stack developer. I love vue and how well it flows but for my side gig of doing a few clients websites for local businesses around here I typically go Wordpress. The themes are so easy to get up and running and I’m just so familiar with it at this point. However customizing stuff is a nightmare unless you’re a php guy or like Jerry rigging an existing theme or like page builders. I have a friend/client who gave me a site to imitate and I thought hey I can do all of that frontend stuff with vue and Vuetify basically rather than trying to make Wordpress fit that molder. The only catch is he wants to write blog posts and also has some other cool projects down the line he might want. Doing an api in .net always seems enticing since I use it at work but to do a cms from scratch is too much work for me. I want something ready to go.

So you might wondering why not just do Wordpress headless? I feel like Wordpress wasn’t meant to be headless and seems like it might be kind of slow. I also have to admit almost every Wordpress site I’ve ever hosted eventually gets hacked even with long passwords. Trying to be better now with MFA but still I think some plugins just leave vulnerability so I am leaning away from headless Wordpress. But still open to it if you convince me lol.

The two big dogs I hear are strapi and then the new guy in town (maybe not so new now) payload cms. I tried strapi for a minute and seems like a cool concept as you can create objects/models and it kind of creates the relationship and crud functions for you for the api. I love this concept and feel like it’s going to make this blog idea more realistic for a custom build outside of Wordpress. However, my god there are so many people complaining about strapi im not sure if I want to invest my time into it. I have read documentation is poor, creating controllers/middleware to customize api is difficult, and it’s very buggy. All very general complaints but hard to know what’s true given the current state.

Then there’s payload cms. I haven’t heard a single bad thing about it but also the creators of payload are super active on Reddit it’s hard to see if there’s a bias and their marketing team is just killing it. Not a bad thing for them to be active and good they can hear more feedback but it does change peoples attitudes when posting so I can be skeptical and maybe overly skeptical so don’t rip me a new one for think like this!!. So is payload the answer to my prayers and can solve my inability and unwillingness to build my own api/backend? It seems more oriented towards react and I’m a vue guy so is customizing gonna make me pull my hair out? I would love to hear from some vue guys who use payload and what do you use it for? Can it dk everything strapi can do I mentioned above? The infinite possibilities of sites from this crud automation like strapi?

Lastly, one that caught my eye was prismic. It’s a vue based cms which is enticing since I’m a vue guy. But I don’t see much feedback on it online and if strapi is super buggy and it has so much funding then how buggy is prismic going to be?

So for a small web business that does business websites, blogs, and possibly e-commerce which headless cms do you guys lean towards and why?


Experienced Frontend Developer (Vue 3) Seeking Remote Job Opportunities Experienced Frontend Developer (Vue 3) Seeking Remote Job Opportunities

Hello everyone,

As the title says, I'm currently looking for a new job. The remote company I work for has been experiencing financial difficulties, and they recently laid off four employees. Now, I'm the only frontend developer left, and to make matters worse, they've reduced our wages by 30%, bringing my hourly rate to around $11 USD.

On top of that, I'm expecting a baby soon, so finding a better opportunity has become even more urgent. I've been working with Vue for the past 5 years (3 years with Vue 3 and 2 years with Vue 2). I'm based in Mexico and am specifically interested in remote positions.

If anyone knows of any opportunities, I'd greatly appreciate any leads or advice.

Thank you!





Search Filter issue/ Data Loader Search Filter issue/ Data Loader

I am having issue with the filter. When I remove anything which I had searched it is not clearing the filter when I use Backspace key.

Step 1: Selecting Date range.

Step 2: Selecting Factories (=FACT_001B). 29 Result appears

Step 3: When I search file test_file_to_be_removed.txt in Filename tab. 6 events appears.

Step 4: Deleted test_file_to_be_removed.txt.

Observation: Using (Ctrl + A & Backspace), expected result appear. means getting 29 event table appears.

But when I did not use (Ctrl + A) & try to delete only using Backspace. Expected result does not appear. Here, getting still 6 event appears

vuejs


How can I use an imported component's template in Vue 3? How can I use an imported component's template in Vue 3?

I'm working with a component A in Vue 3 and I want to create another component that inherits A's template while modifying only the script and style. In Vue 2, I used mixins for this:

<script>
import A from './A';

export default {
    mixins: [
        A,
    ],
}
</script>

In Vue 3, I can achieve a similar result like this:

<template>
    <A></A>
</template>

<script setup>
import A from './A';
</script>

However, the Vue 3 documentation advises against this method because it unnecessarily creates new component instances, which can slow down the application if overused:

"When used across an entire application, the amount of extra component instances created by the renderless component pattern can become a noticeable performance overhead."

I'm looking for a way to use component A's template without adding extra components and impacting performance. Any suggestions or best practices for this in Vue 3?


How to get my API client to make calls one at a time instead of all at once? I know I need to write a `for` loop but am struggling to work it out. How to get my API client to make calls one at a time instead of all at once? I know I need to write a `for` loop but am struggling to work it out.

Here is my code: https://github.com/d0uble-happiness/DiscogsCsvVue (please just ignore App_bak)

It is intended to do the following:

  • Take as input a .csv file, the first column of which contains valid discogs release IDs

  • Look these release IDs up on discogs API

  • Return as output the same .csv file, with discogs release data included

I looked in the browser console and read...

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.discogs.com/releases/1,2,3,4,5,. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 404.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.discogs.com/releases/1,2,3,4,5,. (Reason: CORS request did not succeed). Status code: (null).

The URL https://api.discogs.com/releases/1,2,3,4,5, that it's trying to reach is invalid and should really be https://api.discogs.com/releases/1 and so on.

My app is registered with discogs; I have the key & secret.

I have tried to debug it, screencap - https://i.imgur.com/emLnvoe.png

App.vue

<template>
    <div>
        <FileUpload @file="setFile" />
    </div>

    <div>
        <p v-for="row of data" :key="row">
            {{ row }}
        </p>
    </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import FileUpload from '@/components/FileUpload.vue';
import { fetchRelease, parseCsvToArray } from "@/parser";

export default defineComponent({
    name: 'App',
    components: {
        FileUpload,
    },
    data() {
        return {
            data: null as null | string[],
        }
    },
    methods: {
        async setFile(file: File) {
            this.data = await parseCsvToArray(file)
        }
    },
    watch: {
        data(releaseId) {
            fetchRelease(releaseId)
        }
    },
});
</script>

parser.ts

import {DiscogsClient} from "@lionralfs/discogs-client";
import {processReleaseData} from "@/components/ProcessReleaseData";
import Papa from "papaparse";

const db = new DiscogsClient().database();

export async function fetchRelease(releaseId: string): Promise<any[] | { error: string }> {
	try {
		const {data} = await db.getRelease(releaseId);
		return processReleaseData(releaseId, data);
	} catch (error) {
		return {
			error: `Release with ID ${releaseId} does not exist`
		};
	}
}

export async function parseCsvToArray(file: File): Promise<string[]> {
	return new Promise((resolve) => {
		Papa.parse<string[]>(file, {
			header: false,
			complete: (results: Papa.ParseResult<any>) => {
				console.log('Parsed: ', results.data);
				resolve(results.data);
			}
		});
	});
}

ParseCsvToArray.vue

<template>
  <div>
    <p v-for="row of parsedData" v-bind:key="row.id">
      {{ row }}
    </p>
  </div>
</template>

<script lang="ts">

import { defineComponent } from 'vue'
import Papa from 'papaparse';

export default defineComponent({
  name: 'ParseCsvToArray',
  props: {
    file: File
  },
  data() {
    return {
      parsedData: [] as any[]
    }
  },
  methods: {
    parseCsvToArray(file: File) {
      Papa.parse(file, {
        header: false,
        complete: (results: Papa.ParseResult<any>) => {
          console.log('Parsed: ', results.data);
          this.parsedData = results.data;
        }
      });
    }
  },
  mounted() {
    if (this.file) {
      this.parseCsvToArray(this.file);
    }
  },
});

</script>

<style></style>

fetchRelease.ts

import { DiscogsClient } from '@lionralfs/discogs-client';
import { processReleaseData } from './ProcessReleaseData';

export default  {
  name: 'FetchRelease',
  methods: {
    fetchRelease
  }
}

const db = new DiscogsClient().database();

async function fetchRelease(releaseId: string): Promise<any[] | { error: string }> {
  try {
    const { data } = await db.getRelease(releaseId);
    return processReleaseData(releaseId, data);
  } catch (error) {
    return {
      error: `Release with ID ${releaseId} does not exist`
    };
  }
}

I'm trying it like this, but it's not making any API calls at all when I try it this way!

 export async function* fetchRelease(data: string[]): AsyncGenerator<any[] | { error: string }, void, unknown> {
 	for (const releaseId of data) {
 		try {
 			const { data } = await db.getRelease(releaseId);
 			yield processReleaseData(releaseId, data);
 		} catch (error) {
 			yield {
 				error: `Release with ID ${releaseId} does not exist`
 			};
 		}
 	}
 }

lref() new way to write ref() lref() new way to write ref()

Recently i published alfa version of lref() package , is a utility function for Vue 3 that extends the functionality of Vue's reactive reference ref(). It provides a set of convenient methods and properties for managing state, and handling resets.

install npm install lref

Basic usage

import { lref } from "lref";

const { countRef, countComputed, countReset, countInitial } = lref("count", 0);

// Access the reactive reference
console.log(countRef.value); // 0

// Use the computed property
console.log(countComputed.value); // 0

// Reset to initial value
countReset();

// Get the initial value
console.log(countInitial()); // 0

I welcome feedback .


We ditched web components (written with Vue.js) in favor of React components (as a component-first devtool startup) - read why We ditched web components (written with Vue.js) in favor of React components (as a component-first devtool startup) - read why

Hello,

We’ve spent the last two years building a component-first devtool, initially using web components (based on Vue.js) to support multiple frameworks. However, we encountered challenges that led us to switch to React components.

We want to share our learnings behind this transition with you in our detailed analysis covering the following aspects:

  • Why we chose web components (based on Vue.js) initially.

  • The problems we faced that prompted the switch.

  • Tech stack and design options for component-first tools.

  • How we support other frameworks despite choosing React as our core.

Read the full story here.

What's your preferred strategy of building components that should work in various frameworks?




I am developing a Text Input Component based on Skia and Canvas I am developing a Text Input Component based on Skia and Canvas

visit github

TextMagic is the next generation text component. Unlike native input and textarea components, it supports richer text effects and typesetting capabilities. By controlling text layout autonomously, it ensures consistent text display across different platforms and browsers. TextMagic follows a modular design approach, offering both an integrated component(@text-magic) for seamless integration and standalone components for specific needs: u/text-magic/input for text input and u/text-magic/renderer for text typesetting and rendering.

If anyone shares an interest in text or related fields, I welcome discussion and collaboration. I'm also in the process of learning in this area and would appreciate more feedback and assistance.


[PrimeVue] How to change the chip color of a multiselect component? [PrimeVue] How to change the chip color of a multiselect component?

Hi there.. i am digging into the component options and properties as well as slots in order to change the color of the entire chip. it is always grey by default, by i would like to change it for each chip differently. can you help me?

here is the default example at primevue's website:

https://v3.primevue.org/multiselect/#template


Error handler in SPA application Error handler in SPA application

Hi everybody!

There is an application in vue.js composition api script setup using typescript.
The application contacts the server to receive data via http.ts in which axios is created and configured and in the application itself, the call to the API looks something like this:

http.get(url)

The question is: how to correctly implement an error handler in the case of a request to the API?

Let's say that inside http itself, when sending a request via axios, we wrap it in try catch and usually write throw error in catch

Is it good practice to create your own ApiError and throw it?

For example

try {
const { data } = axios.get('url')
return data
} catch (err) {throw ApiError(err)}

If everything is approximately like this, then how to approximately implement such an ApiError

Let's get the error 401 user not authorized?