While there's not much excitement to report from my end this time around, I do have something special for you! I've snagged a ticket to the Vue.js Live 2024 Online conference, and I'm thrilled to raffle it off to one lucky subscriber. Check out the link below for your chance to join in on the action!
👉🏻 In this crash course David East will take you through all of the basics and build an Vue app using Authentication, Firestore, and Vue Router with VueFire.
👉🏻 In this article, we will learn how to build an static web app using Nuxt, with serverless APIs using Azure Functions CLI and Static Web Apps Emulator.
🔥 Vue Tip: Validate Props in Script Setup With TypeScript
You can define prop validations for your component in the script setupscript setup using the defineProps()defineProps() compiler macro. This is a great way to ensure that the props you receive are of the correct type and shape.
Let's first take a look at the official example from the Vue docs without using TypeScript:
1<script setup>2defineProps({3 // Basic type check4 // (null and undefined values will allow any type)5 a: Number,6 // Multiple possible types7 b: [String, Number],8 // Required string9 v: {10 type: String,11 required: true,12 },13 // Number with a default value14 d: {15 type: Number,16 default: 100,17 },18 // Object with a default value19 e: {20 type: Object,21 // Object or array defaults must be returned from22 // a factory function. The function receives the raw23 // props received by the component as the argument.24 default(rawProps) {25 return { message: 'hello' };26 },27 },28 // Custom validator function29 // full props passed as 2nd argument in 3.4+30 f: {31 validator(value, props) {32 // The value must match one of these strings33 return ['success', 'warning', 'danger'].includes(value);34 },35 },36 // Function with a default value37 g: {38 type: Function,39 // Unlike object or array default, this is not a factory40 // function - this is a function to serve as a default value41 default() {42 return ['one, two'];43 },44 },45});46</script>
Now let's rewrite the same example using TypeScript inside script setupscript setup:
All we need to do is define an interface for the props and use the withDefaultswithDefaults helper to set default values. TypeScript will take care of the rest.
👉🏻 Google introduced Interaction to Next Paint (INP) as a new Core Web Vital on March 12 to emphasize the importance of a website's overall responsiveness throughout a user's entire visit.
Sunday, January 5, 2025 Update: Bluesky images work again and thus the Great Art on Bluesky channel is back. If you're on Bluesky please subscribe. # The crazy thing about Bluesky's API is they took already standardized things like links and enclosures, and after 20+ years came up with new definitions. Makes our apps more expensive to maintain, and we waste time and human wear and tear on stupid bullshit make-work. Developers are people, and our work is already horribly overly complex, we're working at the edge of comprehension, and what the fukc let's throw some more unnecessary complication into the mix. Arrogance, narcissism, whatever the source is, it's not a good way to introduce yourself. And, even better, after you go through the maze they break it, with an error message about legacy blob bullshit. They've already done this, and they're just getting started. It's why I say they should just adapt to RSS instead of trying to forc...
评论
发表评论