-
Notifications
You must be signed in to change notification settings - Fork 0
/
115-bc4eac5649ec72ccd951.js
1 lines (1 loc) · 4.92 KB
/
115-bc4eac5649ec72ccd951.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[115],{669:function(t,n,d){"use strict";d.r(n),d.d(n,"default",function(){return w});var e=d(23),a=d.n(e),o=d(24),r=d.n(o),c=d(25),i=d.n(c),s=d(26),h=d.n(s),u=d(32),l=d.n(u),p=d(27),f=d.n(p),m=d(28),g=d.n(m),k=d(580),y=d.n(k),v=d(0),b=d.n(v),x=d(111);function j(t){return b.a.createElement(t.tag,y()({},t.attributes,{dangerouslySetInnerHTML:{__html:t.html}}))}function S(t){return b.a.createElement(j,{tag:"section",html:t.html,attributes:{className:"zandoc-react-markdown"}})}function T(t){return b.a.createElement(j,{tag:"style",html:t.style})}v.Component;var w=function(t){function n(){return a()(this,n),i()(this,h()(n).apply(this,arguments))}return f()(n,t),r()(n,[{key:"componentDidMount",value:function(){var t=location.hash;if(t){var n=document.querySelector('a[href="'.concat(t,'"]'));n&&Object(x.a)(document.documentElement,0,function t(n,d){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(d+=n.offsetTop),t(n.parentNode,d);return d}(n,-9))}}},{key:"render",value:function(){return b.a.createElement("div",{className:"zandoc-react-container",key:null},b.a.createElement(T,{style:""}),b.a.createElement(S,{html:'<h2 class="anchor-heading"><a href="#sku-gui-ge-xuan-ze-qi-yi-fei-qi">¶</a><a href="javascript:void(0)" id="sku-gui-ge-xuan-ze-qi-yi-fei-qi" class="anchor-point"></a>SKU 规格选择器(已废弃)</h2>\n<p>请使用 <code>@zent/sku</code> 这个包。</p>\n<p>这是一个规格选择组件。</p>\n<h3 class="anchor-heading"><a href="#shi-yong-chang-jing">¶</a><a href="javascript:void(0)" id="shi-yong-chang-jing" class="anchor-point"></a>使用场景</h3>\n<p>创建有多种规格的商品、服务的编辑页面</p>\n<h3 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h3>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>默认值</th>\n<th>备选值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>className</td>\n<td>自定义额外类名</td>\n<td>string</td>\n<td><code>\'\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>value</td>\n<td>当前选中的sku列表</td>\n<td>array</td>\n<td><code>[]</code></td>\n<td></td>\n</tr>\n<tr>\n<td>maxSize</td>\n<td>最大规格名称数</td>\n<td>number</td>\n<td><code>3</code></td>\n<td></td>\n</tr>\n<tr>\n<td>maxSKUTextLength</td>\n<td>规格名称文字最大长度</td>\n<td>number</td>\n<td><code>4</code></td>\n<td></td>\n</tr>\n<tr>\n<td>maxLeafTextLength</td>\n<td>规格值文字最大长度</td>\n<td>number</td>\n<td><code>20</code></td>\n<td></td>\n</tr>\n<tr>\n<td>skuTree</td>\n<td>可选的规格列表</td>\n<td>array</td>\n<td><code>[]</code></td>\n<td></td>\n</tr>\n<tr>\n<td>optionValue</td>\n<td>自定义sku的id的key值</td>\n<td>string</td>\n<td><code>\'id\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>optionText</td>\n<td>自定义sku的文案的key值</td>\n<td>string</td>\n<td><code>\'text\'</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onFetchGroup</td>\n<td>异步获取可选的规格列表,如“颜色”、“尺寸”</td>\n<td>function</td>\n<td><code>Promise</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onFetchSKU</td>\n<td>异步获取单个规格可选的值,如“红色”、“蓝色”</td>\n<td>function</td>\n<td><code>Promise</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onCreateGroup</td>\n<td>创建新的规格名,如“星座”</td>\n<td>function</td>\n<td><code>Promise</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onCreateSKU</td>\n<td>创建新的规格值,如“处女座”</td>\n<td>function</td>\n<td><code>Promise</code></td>\n<td></td>\n</tr>\n<tr>\n<td>onChange</td>\n<td>当sku发生改变时的回调,返回值为sku当前value</td>\n<td>function</td>\n<td><code>noop</code></td>\n<td></td>\n</tr>\n<tr>\n<td>prefix</td>\n<td>自定义前缀</td>\n<td>string</td>\n<td>\'rc-sku\'</td>\n<td>null</td>\n</tr>\n</tbody>\n</table>\n<h4 class="anchor-heading"><a href="#gong-ju-fang-fa">¶</a><a href="javascript:void(0)" id="gong-ju-fang-fa" class="anchor-point"></a>工具方法</h4>\n<p>为了更方便操作规格数据,SKU组件提供了一些工具方法</p>\n<h4 class="anchor-heading"><a href="#sku-flatten-sku-items-option">¶</a><a href="javascript:void(0)" id="sku-flatten-sku-items-option" class="anchor-point"></a>SKU.flatten(sku, items, options)</h4>\n<p>通过计算笛卡尔积,将树形的value变成扁平的数组</p>\n<table class="table">\n<thead>\n<tr>\n<th>参数</th>\n<th>说明</th>\n<th>类型</th>\n<th>默认值</th>\n<th>备选值</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>sku</td>\n<td>当前选中规格的value</td>\n<td>array</td>\n<td><code>[]</code></td>\n<td></td>\n</tr>\n<tr>\n<td>items</td>\n<td>当前已存在的数据</td>\n<td>array</td>\n<td><code>[]</code></td>\n<td></td>\n</tr>\n<tr>\n<td>options</td>\n<td>可配置参数</td>\n<td>object</td>\n<td><code>{}</code></td>\n<td><code>optionValue: \'id\', optionText: \'text\'</code></td>\n</tr>\n</tbody>\n</table>'}))}}]),n}(v.Component)}}]);