This commit is contained in:
RickCole21 2020-08-06 15:18:45 +08:00
parent c64d00827b
commit 14031970c4
5 changed files with 361 additions and 366 deletions

View File

@ -7,6 +7,7 @@ menuName: 表达式
icon:
order: 13
---
一般来说,属性名类似于`xxxOn`的配置项,都可以使用表达式进行配置,表达式具有如下的语法:
```json
@ -25,15 +26,10 @@ order: 13
在 amis 的实现过程中,当正则匹配到某个组件存在`xxxOn`语法的属性名时,会尝试进行下面步骤(以上面配置为例):
1. 提取`visibleOn`配置项配置的 JavaScript 语句`data.show === 1`并以当前组件的数据域为这段代码的数据作用域执行这段js代码
1. 提取`visibleOn`配置项配置的 JavaScript 语句`data.show === 1`,并以当前组件的数据域为这段代码的数据作用域,执行这段 js 代码;
2. 之后将执行结果赋值给`visible`并添加到组件属性中
3. 执行渲染。当前示例中:`visible`代表着是否显示当前组件;
组件不同的配置项会有不同的效果,请大家在组件文档中多留意。
> 表达式的执行结果预期应该是`boolean`类型值如果不是amis 会根据 JavaScript 的规则将结果视作`boolean`类型进行判断

View File

@ -652,9 +652,9 @@ export const docs = [
},
{
label: 'ButtonGroup 按钮组',
path: '/docs/components/buttongroup',
path: '/docs/components/button-group',
getComponent: (location, cb) =>
require(['../../docs/components/buttongroup.md'], doc => {
require(['../../docs/components/button-group.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},

View File

@ -251,7 +251,7 @@ export default function (doc) {
</div>
</div>
</div>
{doc.toc && doc.toc.children && doc.toc.children.length > 1 ? (
{doc.toc && doc.toc.children && doc.toc.children.length > 0 ? (
<div className="Doc-toc hidden-xs hidden-sm">
<div>
<div className="Doc-headingList">

View File

@ -1,14 +1,16 @@
/* csshint-disable */
@font-face {
font-family: octicons-link;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFY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-size-adjust: 100%;
color: #333;
font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "STHeiti", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-family: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'STHeiti',
'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
font-size: 16px;
line-height: 1.6;
word-wrap: break-word;
@ -42,7 +44,7 @@
font-weight: bolder;
}
.markdown-body>h1 {
.markdown-body > h1 {
font-size: 2em;
margin: 0.67em 0;
}
@ -78,13 +80,13 @@
}
.markdown-body button:-moz-focusring,
.markdown-body [type="button"]:-moz-focusring,
.markdown-body [type="reset"]:-moz-focusring,
.markdown-body [type="submit"]:-moz-focusring {
.markdown-body [type='button']:-moz-focusring,
.markdown-body [type='reset']:-moz-focusring,
.markdown-body [type='submit']:-moz-focusring {
outline: 1px dotted ButtonText;
}
.markdown-body [type="checkbox"] {
.markdown-body [type='checkbox'] {
box-sizing: border-box;
padding: 0;
}
@ -104,7 +106,8 @@
}
.markdown-body input {
font: 13px/1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
font: 13px/1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean,
sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}
.markdown-body a:not(.btn) {
@ -129,47 +132,47 @@
.markdown-body hr::before {
display: table;
content: "";
content: '';
}
.markdown-body hr::after {
display: table;
clear: both;
content: "";
content: '';
}
.markdown-body>h1,
.markdown-body>h2,
.markdown-body>h3,
.markdown-body>h4,
.markdown-body>h5,
.markdown-body>h6 {
.markdown-body > h1,
.markdown-body > h2,
.markdown-body > h3,
.markdown-body > h4,
.markdown-body > h5,
.markdown-body > h6 {
margin-top: 0;
margin-bottom: 0;
line-height: 1.5;
}
.markdown-body>h1 {
.markdown-body > h1 {
font-size: 30px;
}
.markdown-body>h2 {
.markdown-body > h2 {
font-size: 21px;
}
.markdown-body>h3 {
.markdown-body > h3 {
font-size: 16px;
}
.markdown-body>h4 {
.markdown-body > h4 {
font-size: 14px;
}
.markdown-body>h5 {
.markdown-body > h5 {
font-size: 12px;
}
.markdown-body>h6 {
.markdown-body > h6 {
font-size: 11px;
}
@ -206,14 +209,14 @@
}
.markdown-body code {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
font-size: 12px;
}
.markdown-body pre {
margin-top: 0;
margin-bottom: 0;
font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace;
font: 12px Consolas, 'Liberation Mono', Menlo, Courier, monospace;
}
.markdown-body .pl-0 {
@ -250,20 +253,20 @@
.markdown-body:before {
display: table;
content: "";
content: '';
}
.markdown-body:after {
display: table;
clear: both;
content: "";
content: '';
}
.markdown-body>*:first-child {
.markdown-body > *:first-child {
margin-top: 0 !important;
}
.markdown-body>*:last-child {
.markdown-body > *:last-child {
margin-bottom: 0 !important;
}
@ -282,95 +285,95 @@
outline: none;
}
.markdown-body>h1,
.markdown-body>h2,
.markdown-body>h3,
.markdown-body>h4,
.markdown-body>h5,
.markdown-body>h6 {
.markdown-body > h1,
.markdown-body > h2,
.markdown-body > h3,
.markdown-body > h4,
.markdown-body > h5,
.markdown-body > h6 {
margin-top: 1em;
margin-bottom: 16px;
font-weight: bold;
line-height: 1.4;
}
.markdown-body>h1 .octicon-link,
.markdown-body>h2 .octicon-link,
.markdown-body>h3 .octicon-link,
.markdown-body>h4 .octicon-link,
.markdown-body>h5 .octicon-link,
.markdown-body>h6 .octicon-link {
.markdown-body > h1 .octicon-link,
.markdown-body > h2 .octicon-link,
.markdown-body > h3 .octicon-link,
.markdown-body > h4 .octicon-link,
.markdown-body > h5 .octicon-link,
.markdown-body > h6 .octicon-link {
color: #000;
vertical-align: middle;
visibility: hidden;
}
.markdown-body>h1:hover .anchor,
.markdown-body>h2:hover .anchor,
.markdown-body>h3:hover .anchor,
.markdown-body>h4:hover .anchor,
.markdown-body>h5:hover .anchor,
.markdown-body>h6:hover .anchor {
.markdown-body > h1:hover .anchor,
.markdown-body > h2:hover .anchor,
.markdown-body > h3:hover .anchor,
.markdown-body > h4:hover .anchor,
.markdown-body > h5:hover .anchor,
.markdown-body > h6:hover .anchor {
text-decoration: none;
}
.markdown-body>h1:hover .anchor .octicon-link,
.markdown-body>h2:hover .anchor .octicon-link,
.markdown-body>h3:hover .anchor .octicon-link,
.markdown-body>h4:hover .anchor .octicon-link,
.markdown-body>h5:hover .anchor .octicon-link,
.markdown-body>h6:hover .anchor .octicon-link {
.markdown-body > h1:hover .anchor .octicon-link,
.markdown-body > h2:hover .anchor .octicon-link,
.markdown-body > h3:hover .anchor .octicon-link,
.markdown-body > h4:hover .anchor .octicon-link,
.markdown-body > h5:hover .anchor .octicon-link,
.markdown-body > h6:hover .anchor .octicon-link {
visibility: visible;
}
.markdown-body>h1 {
.markdown-body > h1 {
padding-bottom: 0.3em;
font-size: 2.25em;
line-height: 1.2;
border-bottom: 1px solid #dee5e7;
}
.markdown-body>h1 .anchor {
.markdown-body > h1 .anchor {
line-height: 1;
}
.markdown-body>h2 {
.markdown-body > h2 {
padding-bottom: 0.3em;
font-size: 1.75em;
line-height: 1.225;
border-bottom: 1px solid #dee5e7;
}
.markdown-body>h2 .anchor {
.markdown-body > h2 .anchor {
line-height: 1;
}
.markdown-body>h3 {
.markdown-body > h3 {
font-size: 1.5em;
line-height: 1.43;
}
.markdown-body>h3 .anchor {
.markdown-body > h3 .anchor {
line-height: 1.2;
}
.markdown-body>h4 {
.markdown-body > h4 {
font-size: 1.25em;
}
.markdown-body>h4 .anchor {
.markdown-body > h4 .anchor {
line-height: 1.2;
}
.markdown-body>h5 {
.markdown-body > h5 {
font-size: 1em;
}
.markdown-body>h5 .anchor {
.markdown-body > h5 .anchor {
line-height: 1.1;
}
.markdown-body>h6 {
.markdown-body > h6 {
font-size: 1em;
color: #777;
}
@ -411,7 +414,7 @@
margin-bottom: 0;
}
.markdown-body li>p {
.markdown-body li > p {
margin-top: 16px;
}
@ -438,11 +441,11 @@
border-left: 4px solid #ddd;
}
.markdown-body blockquote>:first-child {
.markdown-body blockquote > :first-child {
margin-top: 0;
}
.markdown-body blockquote>:last-child {
.markdown-body blockquote > :last-child {
margin-bottom: 0;
}
@ -451,7 +454,7 @@
width: 100%;
overflow: auto;
word-break: normal;
word-break: keep-all;
/* word-break: keep-all; */
}
.markdown-body table:not(.table) th {
@ -506,10 +509,10 @@
.markdown-body code:before,
.markdown-body code:after {
letter-spacing: -0.2em;
content: "\00a0";
content: '\00a0';
}
.markdown-body pre>code {
.markdown-body pre > code {
padding: 0;
margin: 0;
font-size: 100%;
@ -675,7 +678,7 @@
.markdown-body kbd {
display: inline-block;
padding: 3px 5px;
font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace;
font: 11px Consolas, 'Liberation Mono', Menlo, Courier, monospace;
line-height: 10px;
color: #555;
vertical-align: middle;
@ -691,7 +694,7 @@
border: 1px solid #4078c0;
}
.markdown-body :checked+.radio-label {
.markdown-body :checked + .radio-label {
position: relative;
z-index: 1;
border-color: #4078c0;
@ -707,7 +710,7 @@
list-style-type: none;
}
.markdown-body .task-list-item+.task-list-item {
.markdown-body .task-list-item + .task-list-item {
margin-top: 3px;
}
@ -751,7 +754,7 @@
padding-left: 0 !important;
}
.markdown-body>.amis-preview {
.markdown-body > .amis-preview {
margin-bottom: 15px;
}

View File

@ -448,10 +448,6 @@ a {
> pre {
margin-bottom: 30px;
}
table:not(.table) {
word-break: break-word;
}
}
}