dustess-snippets
vscode snippets plugin for dustess
version: 0.0.7
author: dustessFE
Offline Install
git clone https://git.dustess.com/lilin1/dustess-snippets.git && cd dustess-snippets
# build
yarn run build
# install
code --install-extension dustess-snippets-0.0.7.vsix
自VS Code版本1.47.0+
开始, 你可以直接拖拽 .vsix
到侧边栏扩展即可安装; see more
Setting
使用前请先在settings.json中配置个人信息
{
"dustessConfig.Author": "User Name",
"dustessConfig.Email": "user-email@dustess.com",
}
Snippets
code
Prefix |
Description |
cf-console-log |
控制台输出 |
cf-ui-mobile-button |
移动端组件库-Button按钮 |
cf-ui-mobile-cell |
移动端组件库-Cell单元格 |
cf-ui-mobile-popup |
移动端组件库-Popup弹出层 |
cf-ui-mobile-checkbox |
移动端组件库-Checkbox复选框 |
cf-ui-mobile-field |
移动端组件库-Field输入框 |
cf-ui-mobile-form |
移动端组件库-Form表单 |
cf-ui-mobile-radio |
移动端组件库-Radio单选框 |
cf-ui-mobile-switch |
移动端组件库-Switch开关 |
cf-ui-mobile-search |
移动端组件库-Search搜索框 |
cf-ui-mobile-action-sheet |
移动端组件库-ActionSheet |
cf-ui-mobile-pull-refresh |
移动端组件库-PullRefresh下拉刷新 |
cf-ui-mobile-empty |
移动端组件库-Empty空组件 |
cf-ui-mobile-list |
移动端组件库-List列表 |
cf-ui-mobile-popover |
移动端组件库-Popover弹出框 |
cf-ui-mobile-tag |
移动端组件库-Tag标签 |
cf-ui-mobile-tab |
移动端组件库-Tab标签页 |
cf-ui-mobile-icon-font |
移动端组件库-Icon图标 |
cf-utils-crypto |
工具库-加解密 |
cf-utils-encrypt-phone |
工具库-加密手机号 |
cf-utils-decrypt-phone |
工具库-解密手机号 |
cf-utils-format-money |
工具库-数字转金额 |
cf-utils-format-file-size |
工具库-文件大小转换 |
cf-utils-download |
工具库-下载文件 |
cf-ui-mobile-toast |
移动端组件库-Toast消息提示 |
cf-ui-mobile-dialog |
移动端组件库-Dialog对话框 |
Snippet Details
code
cf-console-log:【控制台输出】
console.${1|log,info,error|}('${2|LOG:,WARN:,ERROR:,INFO:|}', $0)
cf-ui-mobile-button:【移动端组件库-Button按钮】
<Button type="${1|default,primary,text|}" size="${2|normal,small,mini|}" ${3|success,danger,warning|} @click="() => {})">${4|按钮|}</Button>
cf-ui-mobile-cell:【移动端组件库-Cell单元格】
<Cell title="${1|标题|}" value="${2|值|}" ${3|is-link|} @click="() => {})">${4|内容|}</Cell>
cf-ui-mobile-popup:【移动端组件库-Popup弹出层】
<Popup
v-model:show="show"
position="bottom"
round
safe-area-inset-bottom
teleport="body"
>
${1|<!-- const show = ref(false) -->|}
<Button @click="handleCancel">取消</Button>
<Button type="primary" @click="handleSure">确定</Button>
${2|
<!-- function handleCancel() {
show.value = false;
}
function handleSure() {
show.value = false;
} -->|}
</Popup>
cf-ui-mobile-checkbox:【移动端组件库-Checkbox复选框】
<CheckboxGroup v-model="${1|checked|}">
<Checkbox name="a">复选框 a</Checkbox>
<Checkbox name="b">复选框 b</Checkbox>}
</CheckboxGroup>
cf-ui-mobile-field:【移动端组件库-Field输入框】
<Field
v-model="value"
type="${1|text,tel,digit,number,textarea,password|}"
label="标题"
placeholder="请输入文本"
${2|required|}
${3|is-link|}
/>
cf-ui-mobile-form:【移动端组件库-Form表单】
<Form @failed="onFailed">
<!-- 通过 pattern 进行正则校验 -->
<Field
v-model="value1"
label="文本"
name="pattern"
placeholder="正则校验"
:rules="[{pattern, message: '请输入正确的内容'}]"
/>
<!-- 通过 validator 进行函数校验 -->
<Field
v-model="value2"
label="文本"
name="validator"
placeholder="函数校验"
:rules="[{validator, message: '请输入正确的内容'}]"
/>
<Button type="primary" block>提交</Button>
</Form>
cf-ui-mobile-radio:【移动端组件库-Radio单选框】
<RadioGroup v-model="${1|checked|}">
<Radio name="a">单选框 a</Radio>
<Radio name="b">单选框 b</Radio>
</RadioGroup>
cf-ui-mobile-switch:【移动端组件库-Switch开关】
<Switch v-model="${1|checked|}">${2|开关|}</Switch>
cf-ui-mobile-search:【移动端组件库-Search搜索框】
<form action="/">
<Search
v-model="value1"
placeholder="请输入搜索关键词"
show-action
@search="onSearch"
@cancel="onCancel"
/>
${0}
</form>
cf-ui-mobile-action-sheet:【移动端组件库-ActionSheet】
<ActionSheet
v-model:show="show"
title="标题"
cancel-text="取消"
confirm-text="确认"
/>
cf-ui-mobile-pull-refresh:【移动端组件库-PullRefresh下拉刷新】
<PullRefresh
ref="pullRefreshRef"
v-model="isLoading"
@refresh="onRefresh"
>
${0}
</PullRefresh>
cf-ui-mobile-empty:【移动端组件库-Empty空组件】
<Empty type="${1|no_data,no_video,no_image,no_file,no_conversation,no_message,no_collection,no_order,no_goods,no_task,no_address,no_customer,no_account,no_decorate,activity_over,activity_to_start,open_browser,error_page,error_net,error_data,error_video,error_image,error_file|}" description="${2|描述文字|}">
cf-ui-mobile-list:【移动端组件库-List列表】
<List
v-model:loading="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
${1|<Cell v-for="item in list" :key="item" :title="item" />|}
</List>
cf-ui-mobile-popover:【移动端组件库-Popover弹出框】
<Popover v-model:show="showPopover" placement="${1|top,top-start,top-end,left,left-start,left-end,right,right-start,right-end,bottom,bottom-start,bottom-end|} ">
<template #reference>
<Button type="primary">默认插槽</Button>
</template>
<p style="padding: 12px">${2|hello dustess|}</p>
</Popover>
cf-ui-mobile-tag:【移动端组件库-Tag标签】
<Tag type="${1|default,primary,normal|}" size="${2|medium,small,large|}">小号</Tag>
cf-ui-mobile-tab:【移动端组件库-Tab标签页】
<Tab v-model:active="active">
<TabItem title="标签 1">内容 1</TabItem>
<TabItem title="标签 2" dot>内容 2</TabItem>
<TabItem title="标签 3">内容 3</TabItem>
${0}
</Tab>
cf-ui-mobile-icon-font:【移动端组件库-Icon图标】
<IconFont
icon-class="duero-icon-2938178-wenjianjia1"
type="${1|icon,svg|}"
:size="${2|20|}"
@click="handleClick"
/>
cf-utils-crypto:【工具库-加解密】
c
r
y
p
t
o
.
$
{
1
|
e
n
c
r
y
p
t
,
d
e
c
r
y
p
t
|
}
(
$
{
2
|
1
7
8
0
0
0
0
1
0
0
0
|
}
,
'
$
0
'
)
cf-utils-encrypt-phone:【工具库-加密手机号】
e
n
c
r
y
p
t
P
h
o
n
e
(
$
{
1
|
1
7
8
0
0
0
0
1
0
0
0
|
}
,
'
$
0
'
)
cf-utils-decrypt-phone:【工具库-解密手机号】
d
e
c
r
y
p
t
P
h
o
n
e
(
e
n
c
r
y
p
t
P
h
o
n
e
R
e
s
,
'
1
2
3
4
5
6
'
,
t
r
u
e
)
cf-utils-format-money:【工具库-数字转金额】
f
o
r
m
a
t
M
o
n
e
y
(
$
{
1
|
1
0
0
|
}
)
cf-utils-format-file-size:【工具库-文件大小转换】
f
o
r
m
a
t
F
i
l
e
S
i
z
e
(
$
{
1
|
f
o
n
t
S
i
z
e
|
}
,
$
{
2
|
2
|
}
,
'
$
{
3
|
S
Y
S
T
E
M
,
N
O
R
M
A
L
|
}
'
)
cf-utils-download:【工具库-下载文件】
d
o
w
n
l
o
a
d
(
$
{
1
|
u
r
l
|
}
,
$
{
2
|
f
i
l
e
n
a
m
e
|
}
)
cf-ui-mobile-toast:【移动端组件库-Toast消息提示】
Toast.${1|loading,success,fail|}({
${2|duration: 0|},
forbidClick: ${3|true,false|},
message: '${4|hello dustess|}',
onClose: () => {
${5|console.log('onClose');|}
},
});
cf-ui-mobile-dialog:【移动端组件库-Dialog对话框】
Dialog.${1|alert,confirm|}({
title: '${2|title|}',
message: '${3|message|}',
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(() => {
${4|// on confirm|}
}).catch(() => {
${5|// on cancel|}
})
参与贡献
阅读 dustess-snippets开发和维护指南 参与开发