typescript.json 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. {
  2. "Model definition": {
  3. "prefix": "model",
  4. "body": [
  5. "",
  6. "export class ${1:Comment} extends Model {",
  7. "\tconstructor(data: any = {}) {",
  8. "\t\tsuper( data );",
  9. "\t}",
  10. "}",
  11. "",
  12. "Model.create(${1:Comment});",
  13. ""
  14. ]
  15. },
  16. "Vue Component": {
  17. "prefix": "vue-component",
  18. "body": [
  19. "import Vue from 'vue';",
  20. "import { Component } from 'vue-property-decorator';",
  21. "",
  22. "@Component({})",
  23. "export default class App${2:Component} extends Vue {",
  24. "\t$0",
  25. "}",
  26. ""
  27. ]
  28. },
  29. "Vue Route Component": {
  30. "prefix": "vue-route-component",
  31. "body": [
  32. "import { Route } from 'vue-router';",
  33. "import { Component } from 'vue-property-decorator';",
  34. "",
  35. "@Component({",
  36. "\tname: 'Route${2:Component}',",
  37. "})",
  38. "@RouteResolver({",
  39. "\tresolver: ({ route }) => {$0}",
  40. "})",
  41. "export default class Route${2:Component} extends BaseRouteComponent {}",
  42. ""
  43. ]
  44. },
  45. "Vue Route": {
  46. "prefix": "vue-route",
  47. "body": [
  48. "import { RouteConfig } from 'vue-router';",
  49. "",
  50. "export const route${1:Home}: RouteConfig = {",
  51. "\tname: '${2:home}',",
  52. "\tpath: '${3:home}',",
  53. "\tcomponent: () => import(/* webpackChunkName: \"route${1:Home}\" */ './${4:home}'),",
  54. "};",
  55. "$0"
  56. ]
  57. },
  58. "Vue form": {
  59. "prefix": "vue-form",
  60. "body": [
  61. "import { Component } from 'vue-property-decorator';",
  62. "",
  63. "@Component({})",
  64. "export class Form${1:Login} extends BaseForm<$2> implements FormOnInit {",
  65. "\tmodelClass = $2;",
  66. "",
  67. "\tonInit() {",
  68. "\t\t$0",
  69. "\t}",
  70. "}",
  71. ""
  72. ]
  73. },
  74. "Vue modal component": {
  75. "prefix": "vue-modal-component",
  76. "body": [
  77. "import { Component } from 'vue-property-decorator';",
  78. "",
  79. "@Component({})",
  80. "export default class App${1:Login}Modal extends BaseModal {",
  81. "$0",
  82. "}",
  83. ""
  84. ]
  85. },
  86. "Vue modal service": {
  87. "prefix": "vue-modal-service",
  88. "body": [
  89. "",
  90. "export class ${1:Login}Modal {",
  91. "\tstatic async show($2) {",
  92. "\t\treturn await Modal.show<${3:boolean}>({",
  93. "\t\tmodalId: '${1:Login}',",
  94. "\t\t\tcomponent: () => asyncComponentLoader(import(/* webpackChunkName: \"${1:Login}Modal\" */ './$4')),",
  95. "\t\t\tprops: { $5 },",
  96. "\t\t});",
  97. "\t}",
  98. "}",
  99. "$0"
  100. ]
  101. },
  102. "Vue route resolver": {
  103. "prefix": "vue-route-resolver",
  104. "body": [
  105. "@RouteResolver({",
  106. "\tdeps: {},",
  107. "\tresolver: ({ route }) => Api.sendRequest($1),",
  108. "})$0"
  109. ]
  110. },
  111. "Vue prop definition": {
  112. "prefix": "vue-prop",
  113. "body": ["@Prop({ type: ${1:String}, required: ${2:true} })"]
  114. }
  115. }