Skip to content

Commit

Permalink
fix(cli): 增加模版高亮 默认值描述
Browse files Browse the repository at this point in the history
affects: @varlet/cli, @varlet/ui
  • Loading branch information
齐皓 authored and 齐皓 committed Feb 23, 2021
1 parent babb72d commit 847ae41
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 55 deletions.
3 changes: 2 additions & 1 deletion packages/varlet-cli/src/compiler/compileTemplateHighlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function compileAttributes(table: Record<string, any>, attributes: Record
const attrNamespace = `${get(varletConfig, 'namespace')}-${componentName}/${row[0]}`
attributes[attrNamespace] = {
type: row[2],
description: row[1],
description: `${row[1]} 默认值:${row[3]}`,
}
})
}
Expand All @@ -80,6 +80,7 @@ export function compileWebTypes(table: Record<string, any>, webTypes: Record<str
const attributes = attributesTable.map((row: any) => ({
name: row[0],
description: row[1],
default: row[3],
value: {
type: row[2],
kind: 'expression',
Expand Down
108 changes: 54 additions & 54 deletions packages/varlet-ui/highlight/attributes.json
Original file line number Diff line number Diff line change
@@ -1,218 +1,218 @@
{
"var-badge/type": {
"type": "_string_",
"description": "类型, 可选值为 `default`, `primary`, `info`, `success`, `warning`, `danger`"
"description": "类型, 可选值为 `default`, `primary`, `info`, `success`, `warning`, `danger` 默认值:`default`"
},
"var-badge/dot": {
"type": "_boolean_",
"description": "是否为小圆点"
"description": "是否为小圆点 默认值:`false`"
},
"var-badge/value": {
"type": "_string_,_number_",
"description": "徽标中显示的值(当`dot`为`false`时生效)"
"description": "徽标中显示的值(当`dot`为`false`时生效) 默认值:`0`"
},
"var-badge/max-value": {
"type": "_number_",
"description": "徽标中显示的最大值,当`value`大于`max-value`时会显示`max-value+`(当`value`与`max-value`都为数字时生效)"
"description": "徽标中显示的最大值,当`value`大于`max-value`时会显示`max-value+`(当`value`与`max-value`都为数字时生效) 默认值:_"
},
"var-badge/position": {
"type": "_string_",
"description": "徽标标签中有其他标签时定义徽标在其他标签上的位置,可选值`right-top`,`top-bottom`,`left-top`,`left-bottom`"
"description": "徽标标签中有其他标签时定义徽标在其他标签上的位置,可选值`right-top`,`top-bottom`,`left-top`,`left-bottom` 默认值:_"
},
"var-badge/color": {
"type": "_string_",
"description": "自定义徽标的颜色"
"description": "自定义徽标的颜色 默认值:_"
},
"var-badge/icon": {
"type": "_string_",
"description": "自定义徽标中图标的内容(优先级高于`value`)"
"description": "自定义徽标中图标的内容(优先级高于`value`) 默认值:_"
},
"var-button/type": {
"type": "_string_",
"description": "类型, 可选值为 `default`, `primary`, `info`, `success`, `warning`, `danger`"
"description": "类型, 可选值为 `default`, `primary`, `info`, `success`, `warning`, `danger` 默认值:`default`"
},
"var-button/size": {
"type": "_string_",
"description": "尺寸, 可选值为 `normal`, `mini`, `small`, `large`"
"description": "尺寸, 可选值为 `normal`, `mini`, `small`, `large` 默认值:`normal`"
},
"var-button/loading": {
"type": "_boolean_",
"description": "加载状态"
"description": "加载状态 默认值:`false`"
},
"var-button/loading-type": {
"type": "_string_",
"description": "加载动画类型, 可选值同[Loading组件的type属性](#/zh-CN/loading)"
"description": "加载动画类型, 可选值同[Loading组件的type属性](#/zh-CN/loading) 默认值:`wave`"
},
"var-button/loading-size": {
"type": "_string_",
"description": "加载动画尺寸, 可选值同[Loading组件的size属性](#/zh-CN/loading)"
"description": "加载动画尺寸, 可选值同[Loading组件的size属性](#/zh-CN/loading) 默认值:`normal`"
},
"var-button/round": {
"type": "_boolean_",
"description": "圆形按钮"
"description": "圆形按钮 默认值:`false`"
},
"var-button/block": {
"type": "_boolean_",
"description": "块级元素"
"description": "块级元素 默认值:`false`"
},
"var-button/plain": {
"type": "_boolean_",
"description": "朴素按钮"
"description": "朴素按钮 默认值:`false`"
},
"var-button/outline": {
"type": "_boolean_",
"description": "外边框"
"description": "外边框 默认值:`false`"
},
"var-button/disabled": {
"type": "_boolean_",
"description": "禁用状态"
"description": "禁用状态 默认值:`false`"
},
"var-button/color": {
"type": "_string_",
"description": "文字颜色"
"description": "文字颜色 默认值:`-`"
},
"var-button/background": {
"type": "_string_",
"description": "背景"
"description": "背景 默认值:`-`"
},
"var-chip/type": {
"type": "_string_",
"description": "类型, 可选值为 `default`, `primary`, `info`, `success`, `warning`, `danger`"
"description": "类型, 可选值为 `default`, `primary`, `info`, `success`, `warning`, `danger` 默认值:`default`"
},
"var-chip/size": {
"type": "_string_",
"description": "尺寸, 可选值为 `normal`, `mini`, `small`, `large`"
"description": "尺寸, 可选值为 `normal`, `mini`, `small`, `large` 默认值:`normal`"
},
"var-chip/plain": {
"type": "_boolean_",
"description": "是否为空心样式"
"description": "是否为空心样式 默认值:`false`"
},
"var-chip/round": {
"type": "_boolean_",
"description": "是否为圆角样式"
"description": "是否为圆角样式 默认值:`true`"
},
"var-chip/block": {
"type": "_boolean_",
"description": "块级元素"
"description": "块级元素 默认值:`false`"
},
"var-chip/closeable": {
"type": "_boolean_",
"description": "是否为可关闭标签"
"description": "是否为可关闭标签 默认值:`false`"
},
"var-chip/close-name": {
"type": "_string_",
"description": "自定义可关闭标签的图标,必须在closeable为true的条件下才能用"
"description": "自定义可关闭标签的图标,必须在closeable为true的条件下才能用 默认值:_"
},
"var-chip/color": {
"type": "_string_",
"description": "标签颜色"
"description": "标签颜色 默认值:_"
},
"var-chip/text-color": {
"type": "_string_",
"description": "文本颜色,优先级高于`color`属性"
"description": "文本颜色,优先级高于`color`属性 默认值:_"
},
"var-loading/color": {
"type": "_string_",
"description": "loading 的颜色"
"description": "loading 的颜色 默认值:`currentColor`"
},
"var-loading/type": {
"type": "_string_",
"description": "loading 的类型,可选值为 `wave` `cube` `rect` `disappear`"
"description": "loading 的类型,可选值为 `wave` `cube` `rect` `disappear` 默认值:`wave`"
},
"var-loading/size": {
"type": "_string_",
"description": "loading 的大小,可选值位 `large` `normal` `small` `mini`"
"description": "loading 的大小,可选值位 `large` `normal` `small` `mini` 默认值:`normal`"
},
"var-progress/mode": {
"type": "_string_",
"description": "progress 的模式"
"description": "progress 的模式 默认值:`linear`"
},
"var-pull-refresh/v-model": {
"type": "_boolean_",
"description": "是否处于加载中状态"
"description": "是否处于加载中状态 默认值:-"
},
"var-pull-refresh/disabled": {
"type": "_boolean_",
"description": "是否禁用下拉刷新"
"description": "是否禁用下拉刷新 默认值:`false`"
},
"var-pull-refresh/animation-duration": {
"type": "_number_ | _string_",
"description": "动画时长(ms)"
"description": "动画时长(ms) 默认值:`300`"
},
"var-pull-refresh/success-duration": {
"type": "_number_ | _string_",
"description": "成功提示展示时长(ms)"
"description": "成功提示展示时长(ms) 默认值:`2000`"
},
"var-pull-refresh/bgColor": {
"type": "_string_",
"description": "control的背景颜色"
"description": "control的背景颜色 默认值:`#005CAF`"
},
"var-pull-refresh/color": {
"type": "_string_",
"description": "control 的颜色"
"description": "control 的颜色 默认值:`#ffffff`"
},
"var-pull-refresh/successBgColor": {
"type": "_string_",
"description": "成功状态下control的背景颜色"
"description": "成功状态下control的背景颜色 默认值:`#4CAF50`"
},
"var-pull-refresh/successColor": {
"type": "_string_",
"description": "成功状态下control的颜色"
"description": "成功状态下control的颜色 默认值:`ffffff`"
},
"var-rate/v-model": {
"type": "_number_",
"description": "当前分数"
"description": "当前分数 默认值:_"
},
"var-rate/count": {
"type": "_number_",
"description": "评分总数"
"description": "评分总数 默认值:`5`"
},
"var-rate/color": {
"type": "_string_",
"description": "选中时图标的颜色"
"description": "选中时图标的颜色 默认值:`#ff9800`"
},
"var-rate/icon": {
"type": "_string_",
"description": "选中整个图标时的图标样式"
"description": "选中整个图标时的图标样式 默认值:`star`"
},
"var-rate/empty-color": {
"type": "_string_",
"description": "未选中时图标的颜色"
"description": "未选中时图标的颜色 默认值:`#bdbdbd`"
},
"var-rate/empty-icon": {
"type": "_string_",
"description": "未选中时图标的样式"
"description": "未选中时图标的样式 默认值:`star-outline`"
},
"var-rate/size": {
"type": "_number_,_string_",
"description": "图标大小,默认单位为`px`"
"description": "图标大小,默认单位为`px` 默认值:`20`"
},
"var-rate/margin-right": {
"type": "_number_,_string_",
"description": "图标间隔,默认单位为`px`"
"description": "图标间隔,默认单位为`px` 默认值:`4`"
},
"var-rate/half": {
"type": "_boolean_",
"description": "是否允许半选"
"description": "是否允许半选 默认值:`false`"
},
"var-rate/half-icon": {
"type": "_string_",
"description": "半选时图标的样式,只有在`half`为`true`时才有效"
"description": "半选时图标的样式,只有在`half`为`true`时才有效 默认值:`star-half-full`"
},
"var-rate/disabled": {
"type": "_boolean_",
"description": "是否禁止评分"
"description": "是否禁止评分 默认值:`false`"
},
"var-rate/disabled-color": {
"type": "_string_",
"description": "禁止评分时图标的颜色,只有在`disabled`为`true`时才有效,优先级高于`color`、`empty-color`"
"description": "禁止评分时图标的颜色,只有在`disabled`为`true`时才有效,优先级高于`color`、`empty-color` 默认值:`#bdbdbd`"
},
"var-rate/readonly": {
"type": "_boolean_",
"description": "是否使用评分只读"
"description": "是否使用评分只读 默认值:`false`"
},
"var-rate/ripple": {
"type": "_boolean_",
"description": "是否使用水波纹"
"description": "是否使用水波纹 默认值:`false`"
}
}
Loading

0 comments on commit 847ae41

Please sign in to comment.