Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 826 Bytes

course-vuejs3-component-fundamentals.md

File metadata and controls

36 lines (28 loc) · 826 Bytes

VueJS 3 Components Fundamentals

We review this in the next modules:

Registration of components

In VueJS 3, it is slighly different than VueJS 2 :

  • To register globally, we write:
const MyAwesomeComponent = {
  template: "#plan-picker-template",
  data() {
    return {
      someData: "",
    };
  },
};
const app = Vue.createApp({})
  .component("my-component", MyAwesomeComponent)
  .mount("#app");
  • To register locally, it is the same way as VueJS 2, i.e.:
const app = Vue.createApp({
  components: {
    "my-component": MyAwesomeComponent,
  },
}).mount("#app");