Code snippet

role

You can customize your own common code, which is more convenient and quick when writing code in the future

use

Open in Settings



The name of the custom snippet

For example,

My frequently used code snippets (try to update ING)

one

axios try catch

"async await": {"scope": "javascript,typescript"."prefix": "atc"."body": [
  "async $1($3) {"."try {"."const res = await $2($3)"."console.log('$2', res)"."$4"."} catch (error) {"."console.log('$2',error)"."}"."}"]."description": "tcaa"
}
Copy the code

two

Prompt box

"$confirm": {"scope": "javascript,typescript"."prefix": "$ctc"."body": [
     "this.confirm('Sure? ', 'Tips', {"."confirmButtonText: 'YES',"."cancelButtonText: 'NO',"."type: 'warning'"."}).then(() => {"."$1"."}).catch(() => {"."$2"."})"]."description": "confirm then catch"
}
Copy the code

three

.Copy the code