Vue js using cdn

Vue js using cdn

Friends in this video tutorial we will teach you how to use vuejs with the help of steps and with the help of steps while using vuejs we will create our own components, router and many other things.

vuejs cdn

<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
Vuejs code

Firstway

<div id="app">{{ message }}</div>

<script>
  const { createApp, ref } = Vue

  createApp({
    setup() {
      const message = ref('Hello vue!')
      return {
        message
      }
    }
  }).mount('#app')
</script>
Secondway

<div id="app">{{ counter }}</div>

let firstvar = {
  data(){
   return{
     counter:0
   }
  }
}

Vue.createApp(firstvar).mount('#app');
Thirdway

<div id="app"></div>

<script type="module">
import { createApp } from 'vue'
import MyComponent from './my-component.js'

createApp(MyComponent).mount('#app')
</script>
install http server for vue js easy to work

npm install -g http-server
goto to command prompt > goto vue path and run

http-server

 

 

Leave a Reply