-
-
+
- gutter 20px
+ gutter {{ gutter }}px
- gutter 20px
+ gutter {{ gutter }}px
- gutter 20px
+ gutter {{ gutter }}px
diff --git a/examples/sites/demos/pc/app/layout/order-composition-api.vue b/examples/sites/demos/pc/app/layout/order-composition-api.vue
index 44fa87b4e..3e75f3f91 100644
--- a/examples/sites/demos/pc/app/layout/order-composition-api.vue
+++ b/examples/sites/demos/pc/app/layout/order-composition-api.vue
@@ -1,6 +1,11 @@
+
+
+ {{ state.buttonLabel }}
+
+
3
@@ -15,9 +20,6 @@
4
-
- {{ state.buttonLabel }}
-
diff --git a/examples/sites/demos/pc/app/layout/order.vue b/examples/sites/demos/pc/app/layout/order.vue
index 256a8a793..231b64658 100644
--- a/examples/sites/demos/pc/app/layout/order.vue
+++ b/examples/sites/demos/pc/app/layout/order.vue
@@ -1,6 +1,11 @@
+
+
+ {{ state.buttonLabel }}
+
+
3
@@ -15,11 +20,6 @@
4
-
-
- {{ state.buttonLabel }}
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/align-composition-api.vue b/examples/sites/demos/pc/app/layout/row/align-composition-api.vue
deleted file mode 100644
index d9d831b70..000000000
--- a/examples/sites/demos/pc/app/layout/row/align-composition-api.vue
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
-
- 默认
-
-
- 默认
-
-
- 默认
-
-
-
-
- middle
-
-
- middle
-
-
- middle
-
-
-
-
- bottom
-
-
- bottom
-
-
- bottom
-
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/align.vue b/examples/sites/demos/pc/app/layout/row/align.vue
deleted file mode 100644
index 00a256b99..000000000
--- a/examples/sites/demos/pc/app/layout/row/align.vue
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
- 默认
-
-
- 默认
-
-
- 默认
-
-
-
-
- middle
-
-
- middle
-
-
- middle
-
-
-
-
- bottom
-
-
- bottom
-
-
- bottom
-
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/gutter-composition-api.vue b/examples/sites/demos/pc/app/layout/row/gutter-composition-api.vue
deleted file mode 100644
index 2ae59f4c7..000000000
--- a/examples/sites/demos/pc/app/layout/row/gutter-composition-api.vue
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
- 默认
-
-
- 默认
-
-
- 默认
-
-
-
-
- 20
-
-
- 20
-
-
- 20
-
-
-
-
- 50
-
-
- 50
-
-
- 50
-
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/gutter-nospace-composition-api.vue b/examples/sites/demos/pc/app/layout/row/gutter-nospace-composition-api.vue
deleted file mode 100644
index fa04f4f2a..000000000
--- a/examples/sites/demos/pc/app/layout/row/gutter-nospace-composition-api.vue
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
- no gutter
-
-
- no gutter
-
-
- no gutter
-
-
-
-
- 0 gutter
-
-
- 0 gutter
-
-
- 0 gutter
-
-
-
-
-
- no gutter no space
-
-
- no gutter no space
-
-
- no gutter no space
-
-
-
-
- 0 gutter no space
-
-
- 0 gutter no space
-
-
- 0 gutter no space
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/gutter-nospace.vue b/examples/sites/demos/pc/app/layout/row/gutter-nospace.vue
deleted file mode 100644
index fd38e925d..000000000
--- a/examples/sites/demos/pc/app/layout/row/gutter-nospace.vue
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
- no gutter
-
-
- no gutter
-
-
- no gutter
-
-
-
-
- 0 gutter
-
-
- 0 gutter
-
-
- 0 gutter
-
-
-
-
-
- no gutter no space
-
-
- no gutter no space
-
-
- no gutter no space
-
-
-
-
- 0 gutter no space
-
-
- 0 gutter no space
-
-
- 0 gutter no space
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/gutter.vue b/examples/sites/demos/pc/app/layout/row/gutter.vue
deleted file mode 100644
index 6b411a6a7..000000000
--- a/examples/sites/demos/pc/app/layout/row/gutter.vue
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
-
- 默认
-
-
- 默认
-
-
- 默认
-
-
-
-
- 20
-
-
- 20
-
-
- 20
-
-
-
-
- 50
-
-
- 50
-
-
- 50
-
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/justify-composition-api.vue b/examples/sites/demos/pc/app/layout/row/justify-composition-api.vue
deleted file mode 100644
index e6c7fb98c..000000000
--- a/examples/sites/demos/pc/app/layout/row/justify-composition-api.vue
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
- 默认
-
-
- 默认
-
-
- 默认
-
-
-
-
- end
-
-
- end
-
-
- end
-
-
-
-
- center
-
-
- center
-
-
- center
-
-
-
-
- space-around
-
-
- space-around
-
-
- space-around
-
-
-
-
- space-between
-
-
- space-between
-
-
- space-between
-
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/justify.vue b/examples/sites/demos/pc/app/layout/row/justify.vue
deleted file mode 100644
index af300c9c4..000000000
--- a/examples/sites/demos/pc/app/layout/row/justify.vue
+++ /dev/null
@@ -1,85 +0,0 @@
-
-
-
-
- 默认
-
-
- 默认
-
-
- 默认
-
-
-
-
- end
-
-
- end
-
-
- end
-
-
-
-
- center
-
-
- center
-
-
- center
-
-
-
-
- space-around
-
-
- space-around
-
-
- space-around
-
-
-
-
- space-between
-
-
- space-between
-
-
- space-between
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/sites/demos/pc/app/layout/row/order-composition-api.vue b/examples/sites/demos/pc/app/layout/row/order-composition-api.vue
deleted file mode 100644
index d8f97bcae..000000000
--- a/examples/sites/demos/pc/app/layout/row/order-composition-api.vue
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
- 3 asc
-
-
- 1 asc
-
-
- 2 asc
-
-
- 4 asc
-
-
-
-
- 1 des
-
-
- 2 des
-
-
- 4 des
-
-
- 3 des
-
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/order.vue b/examples/sites/demos/pc/app/layout/row/order.vue
deleted file mode 100644
index dfa9b2341..000000000
--- a/examples/sites/demos/pc/app/layout/row/order.vue
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
- 3 asc
-
-
- 1 asc
-
-
- 2 asc
-
-
- 4 asc
-
-
-
-
- 1 des
-
-
- 2 des
-
-
- 4 des
-
-
- 3 des
-
-
-
-
-
-
-
-
diff --git a/examples/sites/demos/pc/app/layout/row/webdoc/row.js b/examples/sites/demos/pc/app/layout/row/webdoc/row.js
deleted file mode 100644
index f5d475f6e..000000000
--- a/examples/sites/demos/pc/app/layout/row/webdoc/row.js
+++ /dev/null
@@ -1,82 +0,0 @@
-export default {
- column: '2',
- owner: '',
- demos: [],
- apis: [
- {
- 'name': 'row',
- 'type': 'component',
- 'properties': [
- {
- 'name': 'align',
- 'type': 'String',
- 'defaultValue': '该属性的默认值为 top',
- 'desc': {
- 'zh-CN': 'flex 布局下的垂直排列方式;该属性的可选值为 top / middle / bottom',
- 'en-US':
- 'vertical arrangement mode in the flex layout; The value of this attribute can be top / middle / bottom'
- },
- 'demoId': 'align'
- },
- {
- 'name': 'flex',
- 'type': 'Boolean',
- 'defaultValue': '',
- 'desc': {
- 'zh-CN': '启用 flex 布局模式,现代浏览器下有效',
- 'en-US': 'Enable the flex layout mode. This parameter is valid in modern browsers.'
- },
- 'demoId': ''
- },
- {
- 'name': 'gutter',
- 'type': 'Number',
- 'defaultValue': '该属性的默认值为 0',
- 'desc': { 'zh-CN': '栅格间隔', 'en-US': 'Grid Interval' },
- 'demoId': 'align'
- },
- {
- 'name': 'justify',
- 'type': 'String',
- 'defaultValue': '该属性的默认值为 start',
- 'desc': {
- 'zh-CN': 'flex 布局下的水平排列方式;该属性的可选值为 start / end / center / space-around / space-between',
- 'en-US':
- 'horizontal arrangement mode in flex layout; The optional value of this attribute is start / end / center / space-around / space-between'
- },
- 'demoId': 'align'
- },
- {
- 'name': 'order',
- 'type': 'String',
- 'defaultValue': '',
- 'desc': {
- 'zh-CN': 'flex 布局下排序方式;该属性的可选值为 asc / des',
- 'en-US': 'Flex layout sorting mode; The optional value of this attribute is asc / des'
- },
- 'demoId': 'align'
- },
- {
- 'name': 'tag',
- 'type': 'String',
- 'defaultValue': '该属性的默认值为 div',
- 'desc': {
- 'zh-CN': '自定义元素标签,可选任意标签;该属性的可选值为 *',
- 'en-US': 'User-defined element label. Any label can be selected. The optional value of this attribute is *'
- },
- 'demoId': 'align'
- }
- ],
- 'events': [],
- 'slots': [
- {
- 'name': 'default',
- 'type': '',
- 'defaultValue': '',
- 'desc': { 'zh-CN': '默认插槽', 'en-US': 'Default slot' },
- 'demoId': 'base'
- }
- ]
- }
- ]
-}
diff --git a/examples/sites/demos/pc/app/layout/row/tag1-composition-api.vue b/examples/sites/demos/pc/app/layout/tag-composition-api.vue
similarity index 100%
rename from examples/sites/demos/pc/app/layout/row/tag1-composition-api.vue
rename to examples/sites/demos/pc/app/layout/tag-composition-api.vue
diff --git a/examples/sites/demos/pc/app/layout/row/tag1.vue b/examples/sites/demos/pc/app/layout/tag.vue
similarity index 100%
rename from examples/sites/demos/pc/app/layout/row/tag1.vue
rename to examples/sites/demos/pc/app/layout/tag.vue
diff --git a/examples/sites/demos/pc/app/layout/webdoc/layout.cn.md b/examples/sites/demos/pc/app/layout/webdoc/layout.cn.md
index 9aa282315..c852fe1f7 100644
--- a/examples/sites/demos/pc/app/layout/webdoc/layout.cn.md
+++ b/examples/sites/demos/pc/app/layout/webdoc/layout.cn.md
@@ -4,4 +4,4 @@ title: Layout 布局
# Layout 布局
-
采用12栅格布局,可使页面布局变得非常简单与清晰。
+
支持 12/24 栅格布局,可使页面布局变得非常简单与清晰。
diff --git a/examples/sites/demos/pc/app/layout/webdoc/layout.en.md b/examples/sites/demos/pc/app/layout/webdoc/layout.en.md
index 6c4dbd8f0..4e73a9713 100644
--- a/examples/sites/demos/pc/app/layout/webdoc/layout.en.md
+++ b/examples/sites/demos/pc/app/layout/webdoc/layout.en.md
@@ -4,4 +4,4 @@ title: Layout
# Layout
-
The grid layout makes the layout simple and clear.
+
The 12/24 grid layout makes the layout simple and clear.
diff --git a/examples/sites/demos/pc/app/layout/webdoc/layout.js b/examples/sites/demos/pc/app/layout/webdoc/layout.js
index b428acb9d..a09b8492c 100644
--- a/examples/sites/demos/pc/app/layout/webdoc/layout.js
+++ b/examples/sites/demos/pc/app/layout/webdoc/layout.js
@@ -3,124 +3,106 @@ export default {
owner: '',
demos: [
{
- 'demoId': 'base',
- 'name': { 'zh-CN': '栅格布局', 'en-US': 'Grid Layout' },
+ 'demoId': 'basic-usage',
+ 'name': { 'zh-CN': '基本用法', 'en-US': 'Basic usage' },
'desc': {
- 'zh-CN':
- '
通过使用 Row , Col 组件的 span 属性实现栅格系统布局。\n 该系统默认为12栅格,Col 组件的 span之和大于12时,布局会自动换行显示。
\n',
- 'en-US':
- '
The grid system layout is implemented by using the span attribute of the Row, Col component.
\n'
+ 'zh-CN': `
+ 通过在Layout 组件嵌套使用 Row , Col 组件, 来实现对一个区域进行 12/24 栅格布局。
+ 通过Layout 组件的 cols 属性来指定布局的总栅格栏数,组件库默认为12栅格栏;
+ 通过 Col 组件的 span 属性指定每栏所占栅格数。当一行的栅格数之和大于总栅格栏数时,布局会自动换行显示。
+
`,
+ 'en-US': `
+ A 12/24 grid Layout of an area is implemented by nesting Row, Col components within Layout components.
+ Use the cols property of the Layout component to specify the total number of grid columns for the layout. The component library defaults to 12 grid columns.
+ The span property of the Col component specifies the number of grids per column. When the sum of the number of grids in a row is greater than the total number of grid columns, the layout is automatically wrapped.
+
`
},
- 'codeFiles': ['base.vue']
- },
- {
- 'demoId': 'alignment',
- 'name': { 'zh-CN': '对齐方式', 'en-US': 'Alignment' },
- 'desc': {
- 'zh-CN':
- '
通过设置Row 的 flex 属性为 true 来启用 flex 布局,并通过 justify 与 align 属性调整子元素的对齐方式。
\n
提示
\n
flex 布局存在 IE 兼容性问题,只能在 IE 10 以上运行。
\n
\n',
- 'en-US':
- '
Enable the flex layout by setting the flex property to true. The justify and align attributes are used to adjust the alignment of the child elements.
\n
Prompt
\n
The flex layout has Internet Explorer compatibility issues and can only run on Internet Explorer 10 or later.
\n
\n'
- },
- 'codeFiles': ['alignment.vue']
- },
- {
- 'demoId': 'order',
- 'name': { 'zh-CN': '排序', 'en-US': 'Sort' },
- 'desc': {
- 'zh-CN':
- '
在启用 flex 布局时,可通过设置 Row 组件的 order 属性,给带 no 属性的 col排序。
\n
提示
\n
flex 布局存在 IE 兼容性问题,只能在 IE 10 以上运行。
\n
\n',
- 'en-US':
- '
When enabling the flex layout, you can set the order attribute of the Row component. Sorts the col with the no attribute.
\n
Prompt
\n
The flex layout has Internet Explorer compatibility issues and can only run on Internet Explorer 10 or later.
\n
\n'
- },
- 'codeFiles': ['order.vue']
- },
- {
- 'demoId': 'offset',
- 'name': { 'zh-CN': '偏移', 'en-US': 'Offset' },
- 'desc': {
- 'zh-CN': '
通过设置 Col 组件的 offset 属性来指定分栏偏移的栏数。
\n',
- 'en-US':
- '
Specifies the number of columns offset by setting the offset property of the Col component.
\n'
- },
- 'codeFiles': ['offset.vue']
- },
- {
- 'demoId': 'align',
- 'name': { 'zh-CN': '垂直排列方式', 'en-US': 'vertical arrangement' },
- 'desc': {
- 'zh-CN': '
通过使用 Row 组件的 align 属性实现\tflex 布局下的垂直排列方式。
\n',
- 'en-US':
- '
Use the align attribute of the Row component to implement the vertical arrangement in \tflex layout.
\n'
- },
- 'codeFiles': ['row/align.vue']
- },
- {
- 'demoId': 'gutter',
- 'name': { 'zh-CN': '栅格间隔', 'en-US': 'Grid Interval' },
- 'desc': {
- 'zh-CN': '
通过使用 Row 组件的 gutter 属性实现栅格间隔。
\n',
- 'en-US':
- '
The grid spacing is implemented by using the gutter attribute of the Row component.
\n'
- },
- 'codeFiles': ['gutter.vue']
- },
- {
- 'demoId': 'justify',
- 'name': { 'zh-CN': '水平排列方式', 'en-US': 'horizontal arrangement' },
- 'desc': {
- 'zh-CN': '
通过使用 Row 组件的 justify 属性实现 flex 布局下的水平排列方式。
\n',
- 'en-US':
- '
The justify attribute of the Row component is used to implement horizontal arrangement in the flex layout.
\n'
- },
- 'codeFiles': ['row/justify.vue']
- },
- {
- 'demoId': 'order1',
- 'name': { 'zh-CN': '排序方式', 'en-US': 'Sort by' },
- 'desc': {
- 'zh-CN': '
通过使用 Row 组件的 order 属性实现 flex 布局下排序方式。
\n',
- 'en-US':
- '
The order attribute of the Row component is used to implement the sorting mode in the flex layout.
\n'
- },
- 'codeFiles': ['row/order.vue']
- },
- {
- 'demoId': 'tag1',
- 'name': { 'zh-CN': '自定义元素标签', 'en-US': 'Custom Element Label' },
- 'desc': {
- 'zh-CN': '
通过使用 Row 组件的 tag 属性实现自定义元素标签,可选任意标签。
\n',
- 'en-US':
- '
The tag attribute of the Row component is used to customize element tags. Any tag is optional.
\n'
- },
- 'codeFiles': ['row/tag1.vue']
- },
- {
- 'demoId': 'col-move',
- 'name': { 'zh-CN': '移动', 'en-US': 'Move' },
- 'desc': {
- 'zh-CN': '
通过设置 Col 组件的 move 属性来指定分栏偏移的栏数。
\n',
- 'en-US':
- '
Specifies the number of columns offset by setting the move property of the Col component.
\n'
- },
- 'codeFiles': ['col/col-move.vue']
+ 'codeFiles': ['basic-usage.vue']
},
{
'demoId': 'responsive-layout',
'name': { 'zh-CN': '响应式布局', 'en-US': 'Responsive Layout' },
'desc': {
- 'zh-CN':
- '
参照了 Bootstrap 的响应式设计,预设了五个响应尺寸:xs、sm、md、lg 和 xl。
\n',
- 'en-US':
- '
Referring to the responsive design of Bootstrap, five response sizes are preset: xs, sm, md, lg, and xl.
\n'
+ 'zh-CN': `
+ 在Col 组件预设了五个响应尺寸:xs、sm、md、lg 和 xl,
+ 来指定在每一个媒介查询尺寸时,该列应该占用的栅格数。组件库默认媒介查询的断点位置为768 / 992 / 1200 / 1920
+ 请改变浏览器窗口的大小,观察下面示例中,各列所占栅格的变化。
+
`,
+ 'en-US': `
+ The Col component presets five response sizes: xs, sm, md, lg, and xl.
+ To specify the number of rasters that the column should occupy at each medium query size. The default media query is 768/992/1200/1920
+ In the following example, resize the browser window to see how the columns are placed on the grid.
+
`
},
'codeFiles': ['responsive-layout.vue']
},
+ {
+ 'demoId': 'order',
+ 'name': { 'zh-CN': 'Col 排序', 'en-US': 'Sort' },
+ 'desc': {
+ 'zh-CN': `
+ 在启用Row 组件的 flex 布局时,可通过设置它的 order 属性值为: asc 或 desc,给Col 组件排序。
+ 待排序的列需指定 no 属性为数字值,属性的默认值为0。
+
`,
+ 'en-US': `
+ When you enable the flex layout of the Row component, you can do this by setting its order property to: asc or desc, which sorts Col components.
+ The column to be sorted requires the no attribute to be numeric, which defaults to 0.
+
`
+ },
+ 'codeFiles': ['order.vue']
+ },
+ {
+ 'demoId': 'alignment',
+ 'name': { 'zh-CN': '对齐方式', 'en-US': 'Alignment' },
+ 'desc': {
+ 'zh-CN': `
+ 通过Row 组件的 flex 属性设置为 true 来启用 flex 布局,
+ 并通过 justify 来指定主轴方向的对齐方式,通过 align 属性指定副轴的对齐方式。
+
`,
+ 'en-US': `
+ Enable the flex layout by setting the Row component's flex property to true.
+ Use justify to specify the main axis alignment and the align attribute to specify the secondary axis alignment.
+
`
+ },
+ 'codeFiles': ['alignment.vue']
+ },
+ {
+ 'demoId': 'offset',
+ 'name': { 'zh-CN': '偏移', 'en-US': 'Offset' },
+ 'desc': {
+ 'zh-CN': '
通过设置 Col 组件的 offset 属性来指定当前列偏移的栏数。
',
+ 'en-US':
+ '
You specify the number of columns to offset by by setting the offset property of the Col component.Specifies the number of columns offset by setting the offset property of the Col component.
'
+ },
+ 'codeFiles': ['offset.vue']
+ },
+ {
+ 'demoId': 'gutter',
+ 'name': { 'zh-CN': '栅格间隔', 'en-US': 'Gutter' },
+ 'desc': {
+ 'zh-CN': `
+ 通过使用 Row 组件的 gutter 属性实现栅格间隔。
+ 不设置 gutter 时,组件会默认为 Col 设置 左右10px 的padding值。
+
`,
+ 'en-US': `
+ This is done by using the gutter property of the Row component.
+ Without setting the gutter, the component will default to Col and set the padding value to 10px around the .
+
`
+ },
+ 'codeFiles': ['gutter.vue']
+ },
{
'demoId': 'tag',
'name': { 'zh-CN': '自定义元素标签', 'en-US': 'Custom Element Label' },
- 'desc': { 'zh-CN': '
可选任意标签。
\n', 'en-US': '
The value can be any tag.
\n' },
- 'codeFiles': ['col/tag.vue']
+ 'desc': {
+ 'zh-CN': `
+ 通过使用 Layout / Row / Col 组件的 tag 属性实现自定义元素标签,可选任意标签。默认使用 div
+
`,
+ 'en-US': `
+ Custom element tags can be created by using the tag attribute of the Layout/Row/Col component. Default div
+
`
+ },
+ 'codeFiles': ['tag.vue']
}
],
apis: [
@@ -132,42 +114,49 @@ export default {
'slots': [],
'layout-attrs': [
{
- 'name': 'tag',
- 'type': 'string',
- 'defaultValue': '该属性的默认值为 div',
- 'desc': { 'zh-CN': '标签', 'en-US': '' },
- 'demoId': 'tag1'
+ 'name': 'cols',
+ 'type': 'number',
+ 'defaultValue': '12',
+ 'desc': {
+ 'zh-CN': '总栅格数;该属性的可选值为 12 /24 ',
+ 'en-US': 'Total number of grids; The optional value for this attribute is 12/24'
+ },
+ 'demoId': 'basic-usage'
},
{
- 'name': 'size',
+ 'name': 'tag',
'type': 'string',
- 'defaultValue': '该属性的默认值为 medium',
- 'desc': { 'zh-CN': '大小;该属性的可选值为 medium / small / mini', 'en-US': '' },
- 'demoId': ''
- }
- ],
- 'layout-slots': [
- {
- 'name': 'default',
- 'type': '',
- 'defaultValue': '',
- 'desc': { 'zh-CN': '默认插槽', 'en-US': '' },
- 'demoId': 'base'
+ 'defaultValue': 'div',
+ 'desc': {
+ 'zh-CN': '定义 Layout 元素的渲染后的标签,默认为div',
+ 'en-US': 'Defines the rendered tag of a Layout element, which defaults to div'
+ },
+ 'demoId': 'tag'
}
],
'row-attrs': [
+ {
+ 'name': 'align',
+ 'type': 'string',
+ 'defaultValue': 'top',
+ 'desc': {
+ 'zh-CN': "子项的副轴对齐方向,可取值:'top', 'middle', 'bottom'",
+ 'en-US': `Alignment of minor axes for child items; values: 'top', 'middle', 'bottom'`
+ },
+ 'demoId': 'alignment'
+ },
{
'name': 'flex',
'type': 'boolean',
'defaultValue': 'false',
- 'desc': { 'zh-CN': '是否为flex容器', 'en-US': '' },
+ 'desc': { 'zh-CN': '是否为flex容器', 'en-US': 'Whether it is a flex container' },
'demoId': 'alignment'
},
{
'name': 'gutter',
'type': 'number',
- 'defaultValue': '0',
- 'desc': { 'zh-CN': '子项的间隔的像素', 'en-US': '' },
+ 'defaultValue': '20',
+ 'desc': { 'zh-CN': '子项的间隔的像素', 'en-US': 'The spacing of the child items in pixels' },
'demoId': 'gutter'
},
{
@@ -176,81 +165,87 @@ export default {
'defaultValue': 'start',
'desc': {
'zh-CN': "子项的主轴对齐方向,可取值:'start', 'center', 'end', 'space-between', 'space-around'",
- 'en-US': ''
+ 'en-US': `Main axis alignment direction for child items; values: 'start', 'center', 'end', 'space-between', 'space-around'`
},
'demoId': 'alignment'
},
- {
- 'name': 'align',
- 'type': 'string',
- 'defaultValue': 'top',
- 'desc': { 'zh-CN': "子项的副轴对齐方向,可取值:'top', 'middle', 'bottom'", 'en-US': '' },
- 'demoId': 'alignment'
- },
{
'name': 'order',
'type': 'string',
'defaultValue': '',
- 'desc': { 'zh-CN': "子项的排序方式,可取值:'asc', 'des'。 不设置时,保留子项在模板中的顺序。", 'en-US': '' },
- 'demoId': 'order1'
+ 'desc': {
+ 'zh-CN': "子项的排序方式,可取值:'asc', 'des'。 不设置时,保留子项在模板中的顺序。",
+ 'en-US': `Ordering of the child items; values: 'asc', 'des'. When not set, the order of the child items in the template is preserved.`
+ },
+ 'demoId': 'order'
},
{
'name': 'tag',
'type': 'string',
'defaultValue': 'div',
- 'desc': { 'zh-CN': '定义 Row 元素的渲染后的标签,默认为div', 'en-US': '' },
- 'demoId': 'tag1'
- },
- {
- 'name': 'noSpace',
- 'type': 'boolean',
- 'defaultValue': 'false',
- 'desc': { 'zh-CN': '子项没有间隔,相当于gutter=0的时候', 'en-US': '' },
- 'demoId': ''
+ 'desc': {
+ 'zh-CN': '定义 Row 元素的渲染后的标签,默认为div',
+ 'en-US': 'Defines the rendered tag of a Row element, which defaults to div'
+ },
+ 'demoId': 'tag'
}
],
'col-attrs': [
{
- 'name': 'span',
- 'type': 'number',
- 'defaultValue': '12',
- 'desc': { 'zh-CN': '子项占据的列数', 'en-US': '' },
- 'demoId': 'base'
- },
- {
- 'name': 'offset',
+ 'name': 'move',
'type': 'number',
'defaultValue': '0',
- 'desc': { 'zh-CN': '子项的左偏移量', 'en-US': '' },
+ 'desc': {
+ 'zh-CN': '子项的右偏移量,是通过 left 属性实现偏移,建议使用 offset 代替',
+ 'en-US':
+ 'The right offset of the child item is offset via the left property; it is recommended to use offset instead'
+ },
'demoId': 'offset'
},
{
'name': 'no',
'type': 'number',
'defaultValue': '0',
- 'desc': { 'zh-CN': '子项排序编号', 'en-US': '' },
- 'demoId': 'order1'
+ 'desc': { 'zh-CN': '子项排序编号', 'en-US': 'Subitems are sorted by number' },
+ 'demoId': 'order'
},
{
- 'name': 'move',
+ 'name': 'offset',
'type': 'number',
'defaultValue': '0',
- 'desc': { 'zh-CN': '子项的右偏移量', 'en-US': '' },
- 'demoId': 'col-move'
+ 'desc': {
+ 'zh-CN': '子项的向右偏移量,是通过 margin-left 属性实现偏移',
+ 'en-US': 'The offset to the right of the child item is achieved using the margin-left property'
+ },
+ 'demoId': 'offset'
},
{
- 'name': 'xs/sm/md/lg/xl',
- 'type': 'number, object',
- 'defaultValue': '',
- 'desc': { 'zh-CN': '响应式栅格数或者栅格属性对象', 'en-US': '' },
- 'demoId': 'responsive-layout'
+ 'name': 'span',
+ 'type': 'number',
+ 'defaultValue': '12',
+ 'desc': { 'zh-CN': '子项占据的列数', 'en-US': 'Number of columns occupied by the child' },
+ 'demoId': 'basic-usage'
},
{
'name': 'tag',
'type': 'string',
'defaultValue': 'div',
- 'desc': { 'zh-CN': '子项渲染后的标签', 'en-US': '' },
- 'demoId': ''
+ 'desc': {
+ 'zh-CN': '定义 Col 元素的渲染后的标签,默认为div',
+ 'en-US': 'Defines the rendered tag of a Col element, which defaults to div'
+ },
+ 'demoId': 'tag'
+ },
+ {
+ 'name': 'xs/sm/md/lg/xl',
+ 'type': 'number',
+ 'defaultValue': '',
+ 'desc': {
+ 'zh-CN': '指定列占用响应式栅格数,响应式断点的位置为:768 / 992 / 1200 / 1920',
+ 'en-US':
+ 'Specifies the number of reactive grids occupied by the column and the location of the reactive breakpoint: 768/992/1200/1920'
+ },
+ 'demoId': 'responsive-layout'
}
]
}
diff --git a/package.json b/package.json
index b6cf49325..fda9839e5 100644
--- a/package.json
+++ b/package.json
@@ -44,7 +44,7 @@
"dev2.7:saas": "pnpm create:icon-saas && pnpm build:entry && pnpm -C examples/vue2.7 dev:saas",
"dev:react": "pnpm create:mapping-react && pnpm build:entry-react && pnpm -C examples/react-docs run dev",
"// ---------- 启动官网文档 ----------": "",
- "site": "pnpm build:entry && gulp themeConcat -w & pnpm -C examples/sites start",
+ "site": "pnpm build:entry && pnpm -C examples/sites start",
"site:open": "pnpm build:entry && gulp themeConcat -w & pnpm -C examples/sites start:open",
"// ---------- 启动移动端组件官网文档 ----------": "",
"site:mobile": "pnpm build:entry && gulp themeConcat -w & pnpm -C examples/sites start:mobile",
diff --git a/packages/renderless/src/col/index.ts b/packages/renderless/src/col/index.ts
index c5c953cbd..95c3f8a1c 100644
--- a/packages/renderless/src/col/index.ts
+++ b/packages/renderless/src/col/index.ts
@@ -44,9 +44,9 @@ export const setGlobalAttrValue = ({ attr, className, value }) => {
}
export const getClassName =
- ({ api, props }) =>
+ ({ api, props, state }) =>
() => {
- const multiple = 2
+ const multiple = 24 / state.layout.cols
const span = props.span * multiple
const offset = props.offset
const push = props.move ? props.move : 0
@@ -120,15 +120,10 @@ export const getStyle =
const no = props.no
const styles = []
let gutter = parent ? parent.gutter : null
- let noSpace = parent ? parent.noSpace : null
let order = ''
- if (gutter) {
- gutter = gutter / 2
- styles.push(`padding-left:${gutter}px;padding-right:${gutter}px;`)
- } else if (noSpace) {
- styles.push('padding-left:0;padding-right:0;')
- }
+ gutter = gutter / 2
+ styles.push(`padding-left:${gutter}px;padding-right:${gutter}px;`)
if (parent && parent.flex && parent.order) {
/* istanbul ignore next */
diff --git a/packages/renderless/src/col/vue.ts b/packages/renderless/src/col/vue.ts
index 1f568609d..1e3005d92 100644
--- a/packages/renderless/src/col/vue.ts
+++ b/packages/renderless/src/col/vue.ts
@@ -14,12 +14,13 @@ import { setSubitemAttrValue, setGlobalAttrValue, getClassName, getStyle, row }
export const api = ['state']
-export const renderless = (props, { computed, reactive }, { parent }) => {
+export const renderless = (props, { computed, reactive, inject }, { parent }) => {
const api = {}
const state = reactive({
row: computed(() => api.row()),
style: computed(() => api.getStyle()),
- className: computed(() => api.getClassName())
+ className: computed(() => api.getClassName()),
+ layout: inject('layout')
})
Object.assign(api, {
@@ -28,7 +29,7 @@ export const renderless = (props, { computed, reactive }, { parent }) => {
setGlobalAttrValue,
setSubitemAttrValue,
getStyle: getStyle({ props, state }),
- getClassName: getClassName({ api, props })
+ getClassName: getClassName({ api, props, state })
})
return api
diff --git a/packages/vue/src/layout/src/index.ts b/packages/vue/src/layout/src/index.ts
index fed18d176..46e26f242 100644
--- a/packages/vue/src/layout/src/index.ts
+++ b/packages/vue/src/layout/src/index.ts
@@ -25,10 +25,10 @@ export default defineComponent({
type: String,
default: 'div'
},
- size: {
- type: String,
- default: 'medium',
- validator: (value: string) => Boolean(~['medium', 'small', 'mini'].indexOf(value))
+ cols: {
+ type: Number,
+ default: 12,
+ validator: (value: string) => Boolean(~[12, 24].indexOf(value))
}
},
setup(props, context) {
diff --git a/packages/vue/src/row/src/index.ts b/packages/vue/src/row/src/index.ts
index 6eec62c61..55c187c8f 100644
--- a/packages/vue/src/row/src/index.ts
+++ b/packages/vue/src/row/src/index.ts
@@ -20,7 +20,7 @@ export default defineComponent({
flex: Boolean,
gutter: {
type: Number,
- default: 0,
+ default: 20,
validator(value: number) {
return value >= 0
}
@@ -42,10 +42,6 @@ export default defineComponent({
tag: {
type: String,
default: 'div'
- },
- noSpace: {
- type: Boolean,
- default: false
}
},
setup(props, context) {
diff --git a/packages/vue/src/row/src/pc.vue b/packages/vue/src/row/src/pc.vue
index a87a54d3a..83a12778d 100644
--- a/packages/vue/src/row/src/pc.vue
+++ b/packages/vue/src/row/src/pc.vue
@@ -20,7 +20,7 @@ import { renderless, api } from '@opentiny/vue-renderless/row/vue'
import { props, setup, defineComponent } from '@opentiny/vue-common'
export default defineComponent({
- props: [...props, 'flex', 'gutter', 'justify', 'align', 'order', 'tag', 'noSpace'],
+ props: [...props, 'flex', 'gutter', 'justify', 'align', 'order', 'tag'],
setup(props, context) {
return setup({ props, context, renderless, api })
}