Skip to content

Instantly share code, notes, and snippets.

@qzm
Created June 24, 2017 05:51
Show Gist options
  • Save qzm/c674013a5bebd9a3d84457728fc4b831 to your computer and use it in GitHub Desktop.
Save qzm/c674013a5bebd9a3d84457728fc4b831 to your computer and use it in GitHub Desktop.
vue snippet
{
"vue-components": {
"prefix": "vue-components",
"body": [
"<template>\r",
"\r",
"</template>\r",
"<script>\r",
"export default {\r",
" name: '$1',\r",
" data() {\r",
" return {\r",
" };\r",
" },\r",
" methods: {},\r",
" watch: {},\r",
" computed: {},\r",
" \r",
" mounted() {\r",
"\r",
" },\r",
" created() {\r",
"\r",
" },\r",
" \r",
" components: {\r",
"\r",
" }\r",
"};\r",
"</script>\r",
"\r",
"<style lang=\"scss\">\r",
"\r",
"</style>"
],
"description": "vue-components"
},
"validator": {
"prefix": "validator",
"body": [
" new Validator()",
" .test({",
" data: self.firstContactPhone,",
" rule: 'mobile',",
" fail() { Toast('请输入正确的手机号码'); }",
" })",
" .done(async () => {",
"",
" });"
],
"description": "validator"
},
"import toast": {
"prefix": "import toast",
"body": [
"import Toast from '@/lib/Toast';"
],
"description": "import toast"
},
"import validator": {
"prefix": "import validator",
"body": [
"import { Validator } from '@/lib/Validator';"
],
"description": "import validator"
},
"vue-file": {
"prefix": "vue-file",
"body": [
"<template>\r",
" <div>$1</div>\r",
"</template>\r",
"<script>\r",
"import { setTitle, setBackButton } from '@/lib/Util';\r",
"\r",
"export default {\r",
" name: '$1',\r",
" data() {\r",
" return {\r",
" };\r",
" },\r",
" methods: {},\r",
" watch: {},\r",
" computed: {},\r",
" mounted() {},\r",
" created() {\r",
" setTitle('$2');\r",
" setBackButton(() => history.back());\r",
" },\r",
" components: {}\r",
"};\r",
"</script>\r",
"\r",
"<style lang=\"scss\" scoped>\r",
"\r",
"</style>"
],
"description": "vue-file"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment