Vue Snippets

Post #553 written by Khodok in Code

Content

We need ‘em

JSON
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
  "Vue Component": {
    "prefix": "vue-component",
    "body": [
      "<template>",
      "  $1",
      "</template>",
      "",
      "<script setup>",
      "  $2",
      "</script>",
      "",
      "<style scoped>",
      "  $3",
      "</style>"
    ],
    "description": "Create a Vue component"
  },
  "Vue Component TypeScript": {
    "prefix": "vue-component-ts",
    "body": [
      "<template>",
      "  $1",
      "</template>",
      "",
      "<script setup lang=\"ts\">",
      "  $2",
      "</script>",
      "",
      "<style scoped>",
      "  $3",
      "</style>"
    ],
    "description": "Create a Vue component with TypeScript"
  },
  "Vue Method": {
    "prefix": "vue-method",
    "body": [
      "${1:methodName}() {",
      "  ${2:// method body}",
      "}"
    ],
    "description": "Create a Vue method"
  },
  "Vue Computed Property": {
    "prefix": "vue-computed",
    "body": [
      "computed: {",
      "  ${1:computedProperty}() {",
      "    return ${2:value};",
      "  }",
      "}"
    ],
    "description": "Create a Vue computed property"
  },
  "Vue Watcher": {
    "prefix": "vue-watch",
    "body": [
      "watch: {",
      "  ${1:propertyToWatch}(newValue, oldValue) {",
      "    ${2:// watcher body}",
      "  }",
      "}"
    ],
    "description": "Create a Vue watcher"
  },
  "Vue Script Setup": {
    "prefix": "setup",
    "body": [
      "<script setup>",
      "  $0",
      "</script>"
    ],
    "description": "Create a vue script setup block"
  },
  "Vue Script Setup TypeScript": {
    "prefix": "setup",
    "body": [
      "<script setup lang=\"ts\">",
      "  $0",
      "</script>"
    ],
    "description": "Create a vue script setup block with TypeScript"
  },
  "Vue Scoped": {
    "prefix": "scoped",
    "body": [
      "<style scoped>",
      "  $0",
      "</style>"
    ],
    "description": "Create a scoped style block"
  }
}
Comments

Please Log in to leave a comment.

No comments yet.