YouTip LogoYouTip

Vue3 Syntax

Vue3 Basic Syntax | \\n\\n
\\n {{ message }}\\n
\\n\\n \\n const HelloVueApp = {\\n data() {\\n return {\\n message: 'Hello Vue!!'\\n }\\n }\\n }\\n\\n Vue.createApp(HelloVueApp).mount('#hello-vue')\\n \\n [Try it Β»](#)\\n\\n
\\n \\n
\\n\\n \\n createApp({\\n methods: {\\n greet() {\\n alert('Hello!');\\n }\\n }\\n }).mount('#app');\\n \\n\\n
\\n

{{ reversedMessage }}

\\n
\\n\\n \\n createApp({\\n data() {\\n return {\\n message: 'Hello'\\n }\\n },\\n computed: {\\n reversedMessage() {\\n return this.message.split('').reverse().join('');\\n }\\n }\\n }).mount('#app');\\n \\n\\n
\\n \\n
\\n\\n \\n const app = createApp({});\\n app.component('my-component', {\\n template: '
A custom component!
'\\n });\\n app.mount('#app');\\n \\n\\n
\\n \\n
\\n\\n \\n const app = createApp({});\\n app.component('blog-post', {\\n props: ['title'],\\n template: '

{{ title }}

'\\n });\\n app.mount('#app');\\n \\n\\n
\\n \\n

Total clicks: {{ total }}

\\n
\\n\\n \\n const app = createApp({});\\n app.component('button-counter', {\\n template: '',\\n data() {\\n return {\\n count: 0\\n };\\n },\\n methods: {\\n increment() {\\n this.count++;\\n this.$emit('increment');\\n }\\n }\\n });\\n app.mount('#app');
← Vue3 Builtin ComponentsReact Hooks β†’