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 ...
Monday, November 20, 2023 I'd pay $10K up front # Matt Mullenweg : "Sales of the 100-year plan so far: 0. Hundreds of people filled out the form, though. I think we really messed something up in the follow-up, including not making it self-serve to start. Will review and try again. It's an important promise to us." # I'm very much a customer for this service. It would be worth $10K for to buy 100 years of persistence for my web writing. A simple easy to understand service that helps get the process started. # I transfer scripting.com to Automattic as registrar. # I upload the contents from S3 to Automattic server. Static files, HTML, feeds, images, code. # Automattic provides an API to keep the files updated and so I can add to them as long as I'm still writing. # The files are publicly accessible over HTTP. # Automattic agrees to renew the domain for 100 years, and manage access to the files, with reasona...
评论
发表评论