Translate

New Live Courses

🚀 *Gen AI Engineer Telugu (Production Focused)*
🗓️ *Date:* 30th Sept 2026, 07:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/gr
👥 *Join WA Community:*
https://www.vlrt.in/gw
💡*Course Content:*
https://www.vlrt.in/ai
▶️ *Demo Videos:*
https://www.vlrt.in/gv

🚀 *Service now Admin/ Development (ITSM)FREE Demo in Telugu*
🗓️ *Date:* 30th Sept 2026, 08:00AM IST
📝 *Register Now!:*
https://www.vlrt.in/7r
👥 *Join WA Community:*
https://www.vlrt.in/7w
💡*Course Content:*
https://www.vlrt.in/7c
▶️ *Demo Videos:*
https://www.vlrt.in/7v

🚀 *Vulnerability Management Training Demo*
🗓️ *Date:* 30th Sept 2026, 09:00 AM IST
📝*Register Now!:*
https://www.vlrt.in/vr
👥 *Join Community:*
https://www.vlrt.in/cw
💡 *Course Content:*
https://www.vlrt.in/vc
▶️ *Demo Videos:*
https://www.vlrt.in/Vm

Friday, 19 January 2024

How do you use various CDNs in Vuejs explain with example?094

 How do you use various CDNs in Vuejs explain with example?


Here's how to use various CDNs to include Vue.js in your web projects:

1. Unpkg CDN:

  • Latest version:
    HTML
    <script src="https://unpkg.com/vue@next"></script>

  • Specific version (e.g., v3.2.41):
    HTML
    <script src="https://unpkg.com/vue@3.2.41"></script>

2. jsDelivr CDN:

  • Latest version:
    HTML
    <script src="https://cdn.jsdelivr.net/npm/vue@next"></script>

  • Specific version:
    HTML
    <script src="https://cdn.jsdelivr.net/npm/vue@3.2.41"></script>

3. Google Hosted Libraries:

  • Vue 2 (no longer updated):
    HTML
    <script src="https://ajax.googleapis.com/ajax/libs/vue/2.6.14/vue.min.js"></script>

4. Custom CDN:

  • If you have a custom CDN, use the appropriate URL to reference Vue.js.

Key Points:

  • Direct Inclusion: CDN links allow direct inclusion of Vue.js in HTML without build tools.

  • Development and Prototyping: Ideal for quick experimentation and simple projects.

  • No Build Process: Eliminates setup and configuration, making it faster to get started.

  • Potential Limitations:

  • May not be suitable for production due to caching issues and lack of control over versions.

  • Cannot use Single-File Components (SFCs) directly from CDNs.

Example Usage:


HTML

<!DOCTYPE html>
<html>
<head>
  <title>Vue CDN Example</title>
  <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
  <div id="app">
    <p>{{ message }}</p>
  </div>
  <script>
    const app = Vue.createApp({
      data() {
        return {
          message: 'Hello, Vue from CDN!'
        };
      }
    });
    app.mount('#app');
  </script>
</body>
</html>

Remember:

  • For production environments and more complex projects, consider using a build tool like Vue CLI for better control and optimization.

  • Keep CDN links up-to-date for security and compatibility.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.