.jsxReact组件模板:javascriptreact.json

{
  "Import React": {
    "prefix": "importreact",
    "body": [
      "import React from 'react'\n",
      "class ${1:${TM_FILENAME/(.*).(?:jsx|js)/$1/i}} extends React.Component {",
      "  render () {",
      "    return (",
      "      ${2|null|}",
      "    )",
      "  }",
      "}\n",
      "export default ${1:${TM_FILENAME/(.*).(?:jsx|js)/$1/i}}\n"
    ],
    "description": "引入React基本组件"
  },
  "Import PropTypes": {
    "prefix": "importproptypes",
    "body": [
      "import PropTypes from 'prop-types'"
    ],
    "description": "引入prop-types"
  },
  "Define defaultProps": {
    "prefix": "defaultProps",
    "body": [
      "static defaultProps = {",
      "  $1",
      "}\n"
    ]
  }
}

.jsredux模板:javascript.json

{
  "Import Redux Action": {
    "prefix": "importaction",
    "body": [
      "import { ${1|handleActions,createAction|} } from 'redux-actions'"
    ],
    "description": "导入redux-actions"
  },
  "Create Reducer": {
    "prefix": "reducer",
    "body": [
      "import { handleActions } from 'reduce-actions'",
      "import * as ${1:types} from '@/constants/${2:${TM_FILENAME/(.*)State.(?:jsx|js)/$1Const/i}}'\n",
      "const ${3:initState} = {",
      "\t$4",
      "}\n",
      "export default handleActions({",
      "\t$5",
      "}, ${3:initState})\n"
    ],
    "description": "导入一个reducer模板"
  },
  "Create Action": {
    "prefix": "action",
    "body": [
      "import { ${1|createAction, createActions|} } from 'redux-actions'",
      "import * as ${2:types} from '@/constans/${3:${TM_FILENAME/(.*)Action.(?:jsx|js)/$1Const/i}}'\n",
      "$0"
    ]
  }
}

相关文章:

  • 2022-12-23
  • 2021-08-01
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-09-22
  • 2022-01-27
猜你喜欢
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
  • 2021-04-23
  • 2021-07-05
  • 2021-09-09
  • 2021-12-25
相关资源
相似解决方案