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.
How's it going? I was planning to release the update for Reusable Components yesterday, but things haven't gone as planned. Instead, I will be launching it next week. I need a just a bit more time to make sure that the quality is up to my standards. As I've been updating the course and re-writing all the content and step-by-step refactorings, I've also been able to simplify a few things. It's just like refactoring a piece of code, and it's one of the greatest feelings. I also looked at how much content is in there, and it looks like it will be similar to the Clean Components Toolkit. Lots of great content on how to write highly reusable components, simplified and updated — I can't wait to release the update next week! Oh, and one more thing: I'm doing a podcast with Alex Lichter ! It's called Deja Vue and we'll be releasing the first ...
Tuesday, February 13, 2024 The News tab on the Scripting News home page was set up to request the All category from my FeedLand account. I switched to Tech, it's a bit faster, and probably a better fit. Still looking for a performance issue. # If you're thinking it might be good if President Biden stepped aside for someone younger and nicer to look at, what you really want is President Biden to be younger and nicer looking, and of course he probably wouldn't mind that either. But, as Keith Olbermann spells out so well in his latest Countdown , if he were to step aside that would basically concede the election to Trump. So if you think the old man is being silly and vain, well, he's being a lot smarter than you are, and btw, paying a huge price. If you live to be 81, I bet the last thing you want to do, after the life he's had, is to be in this position. We should get behind him, and tell him so, let him know we don't want anyone else, and we ...
评论
发表评论