\n.button {\n span { color: tomato; }\n &.","author":{"@type":"Organization","name":"Hyperskill"},"datePublished":null,"publisher":{"@type":"Organization","name":"Hyperskill","logo":{"@type":"ImageObject","url":"https://uploads-ssl.webflow.com/64626d21caf69defb18b6dec/6463f2a727e65dc99800236a_Hyperskill-logotype-5.svg"}}}}

Cookie Preferences

We use cookies to enhance your experience. Choose your preference for cookie usage.

Essential cookies are required for basic functionality. Additional cookies help us improve our service and provide analytics.

View third-party services
  • Google Analytics: Website traffic analysis and conversion tracking
  • RudderStack: Analysis of user interactions with the website
  • Microsoft Clarity: User behavior analysis & session recordings
  • Facebook Pixel: Marketing analysis of user activity
Computer scienceFrontend FrameworksVue

Vue Syntax

This will bu just a bunch of syntax examples

Script setup with composition API

<template>
  <button type="button" @click="increment">{{ count }}</button>
</template>
<script setup>
import { ref } from 'vue'; 
const count = ref(0);

const increment = () => count.value++
</script>
<style lang="scss" scoped>
.button {
  span { color: tomato; }
  &.red { color: red; }
}
</style>
.button {
  span { color: tomato; }
  &.red { color: red; }
}

Options API

<template>
 <div>
  <button type="button" @click="increment">{{ count }}</button>
 </div>
</template>
<script>
export default {
  data: () => ({
     count: 0,
  }),
  methods: {
    increment() { this.count++ },
  },
};
</script>

Very simple example

<template><em class="h">{{h}}</em></template>
<script setup>const h;</script>
<style lang="scss" scoped>em { &.h { color: tomato; } }</style>

Sass and Scss

$font-stack: Helvetica, sans-serif;
$primary-color: #333;

body {
  font: 100% $font-stack;
  color: $primary-color;
}
$font-stack: Helvetica, sans-serif
$primary-color: #333

body
  font: 100% $font-stack
  color: $primary-color
How did you like the theory?
Report a typo