webpackJsonp([82],{F8BJ:function(s,t,a){vare=a("AVtK")(null,a("Zdx4"),null,null,null);s.exports=e.exports},KI1o:function(s,t,a){s.exports=a("F8BJ")},Zdx4:function(s,t){s.exports={render:function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("section",[a("h2",{attrs:{id:"CascadePicker"}},[a("a",{staticClass:"anchor",attrs:{href:"#cube-CascadePicker-anchor","aria-hidden":"true"}},[a("svg",{attrs:{"aria-hidden":"true",height:"16",version:"1.1",viewBox:"0 0 16 16",width:"16"}},[a("path",{attrs:{"fill-rule":"evenodd",d:"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"}})])]),s._v(" CascadePicker")]),s._v(""),s._m(0),s._v(""),s._m(1),s._v(""),s._m(2),s._v(""),a("h3",{attrs:{id:"Example"}},[a("a",{staticClass:"anchor",attrs:{href:"#cube-Example-anchor","aria-hidden":"true"}},[a("svg",{attrs:{"aria-hidden":"true",height:"16",version:"1.1",viewBox:"0 0 16 16",width:"16"}},[a("path",{attrs:{"fill-rule":"evenodd",d:"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"}})])]),s._v(" Example")]),s._v(""),s._m(3),s._v(""),a("h3",{attrs:{id:"Propsconfiguration"}},[a("a",{staticClass:"anchor",attrs:{href:"#cube-Propsconfiguration-anchor","aria-hidden":"true"}},[a("svg",{attrs:{"aria-hidden":"true",height:"16",version:"1.1",viewBox:"0 0 16 16",width:"16"}},[a("path",{attrs:{"fill-rule":"evenodd",d:"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"}})])]),s._v(" Props configuration")]),s._v(""),s._m(4),s._v(""),s._m(5),s._v(""),s._m(6),s._v(""),a("h3",{attrs:{id:"Events"}},[a("a",{staticClass:"anchor",attrs:{href:"#cube-Events-anchor","aria-hidden":"true"}},[a("svg",{attrs:{"aria-hidden":"true",height:"16",version:"1.1",viewBox:"0 0 16 16",width:"16"}},[a("path",{attrs:{"fill-rule":"evenodd",d:"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"}})])]),s._v(" Events")]),s._v(""),s._m(7),s._v(""),a("h3",{attrs:{id:"Instancemethods"}},[a("a",{staticClass:"anchor",attrs:{href:"#cube-Instancemethods-anchor","aria-hidden":"true"}},[a("svg",{attrs:{"aria-hidden":"true",height:"16",version:"1.1",viewBox:"0 0 16 16",width:"16"}},[a("path",{attrs:{"fill-rule":"evenodd",d:"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"}})])]),s._v(" Instance methods")]),s._v(""),s._m(8)])},staticRenderFns:[function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("blockquote",[a("p",[s._v("New in 1.2.0+")])])},function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("p",[a("code",{pre:!0},[s._v("CascadePicker")]),s._v(" component is used to implement the cascading change between picker columns. What is the effect of cascade? Considering the usage of province-city-area picker, when the province is changed, you may want the city column to display the exact cities of current province, so does the area column. And the "),a("code",{pre:!0},[s._v("CascadePicker")]),s._v(" is here to help you handle this.")])},function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("p",[a("strong",[s._v("Notice:")]),s._v(" Cause this component used create-api, so you should read "),a("a",{attrs:{href:"#/en-US/docs/create-api"}},[s._v("create-api")]),s._v(" first.")])},function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("ul",[a("li",[a("p",[s._v("Basic usage")]),s._v(""),a("p",[s._v("Comparing to "),a("code",{pre:!0},[s._v("Picker")]),s._v(", the required structure of props data is different for "),a("code",{pre:!0},[s._v("CascadePicker")]),s._v(". The data structure of "),a("code",{pre:!0},[s._v("Picker")]),s._v(" is a two-dimensional array, and each column corresponds to an array. As in "),a("code",{pre:!0},[s._v("CascadePicker")]),s._v(", we need a tree structure, that each item of first column has a "),a("code",{pre:!0},[s._v("children")]),s._v(" property which contains the corresponding data of following columns. Here is an example.")]),s._v(""),a("pre",{pre:!0},[a("code",{attrs:{"v-pre":"",class:"language-html"}},[a("span",{attrs:{class:"hljs-tag"}},[s._v("<"),a("span",{attrs:{class:"hljs-name"}},[s._v("cube-button")]),s._v(""),a("span",{attrs:{class:"hljs-attr"}},[s._v("@click")]),s._v("="),a("span",{attrs:{class:"hljs-string"}},[s._v('"showCascadePicker"')]),s._v(">")]),s._v("Cascade Picker"),a("span",{attrs:{class:"hljs-tag"}},[s._v("</"),a("span",{attrs:{class:"hljs-name"}},[s._v("cube-button")]),s._v(">")]),s._v("\n")])]),s._v(""),a("pre",{pre:!0},[a("code",{attrs:{"v-pre":"",class:"language-js"}},[a("span",{attrs:{class:"hljs-keyword"}},[s._v("const")]),s._v(" cascadeData = [\n {\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Fruit'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Fruit'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("children")]),s._v(": [\n {\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Apple'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Apple'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("children")]),s._v(": [{ "),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("1")]),s._v(", "),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'One'")]),s._v(" }, { "),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("2")]),s._v(", "),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Two'")]),s._v(" }]\n },\n {\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Orange'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Orange'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("children")]),s._v(": [{ "),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("3")]),s._v(", "),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Three'")]),s._v("}, { "),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("4")]),s._v(", "),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Four'")]),s._v(" }]\n }\n ]\n },\n {\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Drink'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Drink'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("children")]),s._v(": [\n {\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Coffee'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Coffee'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("children")]),s._v(": [{ "),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("1")]),s._v(", "),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'One'")]),s._v(" }, { "),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("2")]),s._v(", "),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Two'")]),s._v(" }]\n },\n {\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Tea'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Tea'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("children")]),s._v(": [{ "),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("1")]),s._v(", "),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'One'")]),s._v(" }, { "),a("span",{attrs:{class:"hljs-attr"}},[s._v("value")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("3")]),s._v(", "),a("span",{attrs:{class:"hljs-attr"}},[s._v("text")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Three'")]),s._v("}]\n }\n ]\n }\n]\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("export")]),s._v(""),a("span",{attrs:{class:"hljs-keyword"}},[s._v("default")]),s._v(" {\n mounted () {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".cascadePicker = "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createCascadePicker({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("title")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Cascade Picker'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("data")]),s._v(": cascadeData,\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("selectedIndex")]),s._v(": ["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v(", "),a("span",{attrs:{class:"hljs-number"}},[s._v("1")]),s._v(", "),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("],\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onSelect")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".selectHandle,\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onCancel")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".cancelHandle\n })\n },\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("methods")]),s._v(": {\n showCascadePicker() {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".cascadePicker.show()\n },\n selectHandle(selectedVal, selectedIndex, selectedText) {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createDialog({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("type")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'warn'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("content")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("`Selected Item: <br/> - value: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedVal.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("', '")]),s._v(")}")]),s._v(" <br/> - index: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedIndex.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("', '")]),s._v(")}")]),s._v(" <br/> - text: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedText.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("' '")]),s._v(")}")]),s._v("`")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("icon")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'cubeic-alert'")]),s._v("\n }).show()\n },\n cancelHandle() {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createToast({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("type")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'correct'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("txt")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Picker canceled'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("time")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("1000")]),s._v("\n }).show()\n }\n }\n}\n")])]),s._v(""),a("p",[s._v("When the first column goes to "),a("code",{pre:!0},[s._v("Fruit")]),s._v(", the data of second column are "),a("code",{pre:!0},[s._v("Apple")]),s._v(" and "),a("code",{pre:!0},[s._v("Orange")]),s._v(". And so on, when the second column goes to on "),a("code",{pre:!0},[s._v("Orange")]),s._v(", the data of third column are "),a("code",{pre:!0},[s._v("Three")]),s._v(" and "),a("code",{pre:!0},[s._v("Four")]),s._v(".")])]),s._v(""),a("li",[a("p",[s._v("Address Picker")]),s._v(""),a("p",[s._v("For address picker, the only thing you need to do is constructing the cascading data.")]),s._v(""),a("pre",{pre:!0},[a("code",{attrs:{"v-pre":"",class:"language-html"}},[a("span",{attrs:{class:"hljs-tag"}},[s._v("<"),a("span",{attrs:{class:"hljs-name"}},[s._v("cube-button")]),s._v(""),a("span",{attrs:{class:"hljs-attr"}},[s._v("@click")]),s._v("="),a("span",{attrs:{class:"hljs-string"}},[s._v('"showAddressPicker"')]),s._v(">")]),s._v("Address Picker"),a("span",{attrs:{class:"hljs-tag"}},[s._v("</"),a("span",{attrs:{class:"hljs-name"}},[s._v("cube-button")]),s._v(">")]),s._v("\n")])]),s._v(""),a("pre",{pre:!0},[a("code",{attrs:{"v-pre":"",class:"language-js"}},[a("span",{attrs:{class:"hljs-keyword"}},[s._v("import")]),s._v(" { provinceList, cityList, areaList } "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("from")]),s._v(""),a("span",{attrs:{class:"hljs-string"}},[s._v("'example/data/area'")]),s._v("\n\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("const")]),s._v(" addressData = provinceList\naddressData.forEach("),a("span",{attrs:{class:"hljs-function"}},[a("span",{attrs:{class:"hljs-params"}},[s._v("province")]),s._v(" =>")]),s._v(" {\n province.children = cityList[province.value]\n province.children.forEach("),a("span",{attrs:{class:"hljs-function"}},[a("span",{attrs:{class:"hljs-params"}},[s._v("city")]),s._v(" =>")]),s._v(" {\n city.children = areaList[city.value]\n })\n})\n\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("export")]),s._v(""),a("span",{attrs:{class:"hljs-keyword"}},[s._v("default")]),s._v(" {\n mounted () {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".addressPicker = "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createCascadePicker({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("title")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'City Picker'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("data")]),s._v(": addressData,\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onSelect")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".selectHandle,\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onCancel")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".cancelHandle\n })\n },\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("methods")]),s._v(": {\n showAddressPicker() {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".addressPicker.show()\n },\n selectHandle(selectedVal, selectedIndex, selectedText) {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createDialog({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("type")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'warn'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("content")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("`Selected Item: <br/> - value: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedVal.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("', '")]),s._v(")}")]),s._v(" <br/> - index: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedIndex.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("', '")]),s._v(")}")]),s._v(" <br/> - text: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedText.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("' '")]),s._v(")}")]),s._v("`")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("icon")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'cubeic-alert'")]),s._v("\n }).show()\n },\n cancelHandle() {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createToast({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("type")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'correct'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("txt")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Picker canceled'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("time")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("1000")]),s._v("\n }).show()\n }\n }\n}\n")])])]),s._v(""),a("li",[a("p",[s._v("Instance method "),a("code",{pre:!0},[s._v("setData")])]),s._v(""),a("p",[s._v("You could use "),a("code",{pre:!0},[s._v("setData")]),s._v(" to reset the cascading data and selected index of "),a("code",{pre:!0},[s._v("CascadePicker")]),s._v(" instance no matter whether the picker is visible.")]),s._v(""),a("pre",{pre:!0},[a("code",{attrs:{"v-pre":"",class:"language-html"}},[a("span",{attrs:{class:"hljs-tag"}},[s._v("<"),a("span",{attrs:{class:"hljs-name"}},[s._v("cube-button")]),s._v(""),a("span",{attrs:{class:"hljs-attr"}},[s._v("@click")]),s._v("="),a("span",{attrs:{class:"hljs-string"}},[s._v('"showSetDataPicker"')]),s._v(">")]),s._v("SetData Picker"),a("span",{attrs:{class:"hljs-tag"}},[s._v("</"),a("span",{attrs:{class:"hljs-name"}},[s._v("cube-button")]),s._v(">")]),s._v("\n")])]),s._v(""),a("pre",{pre:!0},[a("code",{attrs:{"v-pre":"",class:"language-js"}},[a("span",{attrs:{class:"hljs-keyword"}},[s._v("export")]),s._v(""),a("span",{attrs:{class:"hljs-keyword"}},[s._v("default")]),s._v(" {\n mounted () {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".setDataPicker = "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createCascadePicker({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("title")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Set Data'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onSelect")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".selectHandle,\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onCancel")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".cancelHandle\n })\n },\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("methods")]),s._v(": {\n showSetDataPicker() {\n"),a("span",{attrs:{class:"hljs-comment"}},[s._v("// setData when the picker is invisible.")]),s._v("\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".setDataPicker.setData(cascadeData)\n\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".setDataPicker.show()\n setTimeout("),a("span",{attrs:{class:"hljs-function"}},[a("span",{attrs:{class:"hljs-params"}},[s._v("()")]),s._v(" =>")]),s._v(" {\n"),a("span",{attrs:{class:"hljs-comment"}},[s._v("// setData when the picker is visible.")]),s._v("\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".setDataPicker.setData(addressData, ["),a("span",{attrs:{class:"hljs-number"}},[s._v("1")]),s._v(", "),a("span",{attrs:{class:"hljs-number"}},[s._v("1")]),s._v(", "),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("])\n }, "),a("span",{attrs:{class:"hljs-number"}},[s._v("1000")]),s._v(")\n },\n selectHandle(selectedVal, selectedIndex, selectedText) {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createDialog({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("type")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'warn'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("content")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("`Selected Item: <br/> - value: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedVal.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("', '")]),s._v(")}")]),s._v(" <br/> - index: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedIndex.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("', '")]),s._v(")}")]),s._v(" <br/> - text: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedText.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("' '")]),s._v(")}")]),s._v("`")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("icon")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'cubeic-alert'")]),s._v("\n }).show()\n },\n cancelHandle() {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createToast({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("type")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'correct'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("txt")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Picker canceled'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("time")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("1000")]),s._v("\n }).show()\n }\n }\n}\n")])])]),s._v(""),a("li",[a("p",[s._v("Async load data")]),s._v(""),a("p",[s._v("When the data is too large, it will be really hard to construct the whole cascade data tree at beginning. For this case, you could use the property "),a("code",{pre:!0},[s._v("async")]),s._v(" to enable async load data and update the data at the event "),a("code",{pre:!0},[s._v("change")]),s._v(". Before the data is updated, we will block the confirm handler temporarily.")]),s._v(""),a("pre",{pre:!0},[a("code",{attrs:{"v-pre":"",class:"language-html"}},[a("span",{attrs:{class:"hljs-tag"}},[s._v("<"),a("span",{attrs:{class:"hljs-name"}},[s._v("cube-button")]),s._v(""),a("span",{attrs:{class:"hljs-attr"}},[s._v("@click")]),s._v("="),a("span",{attrs:{class:"hljs-string"}},[s._v('"showAsyncPicker"')]),s._v(">")]),s._v("Async Load Data"),a("span",{attrs:{class:"hljs-tag"}},[s._v("</"),a("span",{attrs:{class:"hljs-name"}},[s._v("cube-button")]),s._v(">")]),s._v("\n")])]),s._v(""),a("pre",{pre:!0},[a("code",{attrs:{"v-pre":"",class:"language-js"}},[a("span",{attrs:{class:"hljs-keyword"}},[s._v("import")]),s._v(" { provinceList, cityList, areaList } "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("from")]),s._v(""),a("span",{attrs:{class:"hljs-string"}},[s._v("'example/data/area'")]),s._v("\n\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("const")]),s._v(" asyncData = provinceList\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("const")]),s._v(" asyncSelectedIndex = ["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v(", "),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v(", "),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("]\nasyncData["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].children = cityList[asyncData["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].value]\nasyncData["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].children["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].children = areaList[asyncData["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].children["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].value]\n\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("export")]),s._v(""),a("span",{attrs:{class:"hljs-keyword"}},[s._v("default")]),s._v(" {\n mounted () {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".asyncPicker = "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createCascadePicker({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("title")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Async Load Data'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("async")]),s._v(": "),a("span",{attrs:{class:"hljs-literal"}},[s._v("true")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("data")]),s._v(": asyncData,\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("selectedIndex")]),s._v(": asyncSelectedIndex.slice(),\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onSelect")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".selectHandle,\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onCancel")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".cancelHandle,\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("onChange")]),s._v(": "),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".asyncChangeHandle\n })\n },\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("methods")]),s._v(": {\n asyncChangeHandle(i, newIndex) {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("if")]),s._v(" (newIndex !== asyncSelectedIndex[i]) {\n asyncSelectedIndex[i] = newIndex\n"),a("span",{attrs:{class:"hljs-comment"}},[s._v("// If the first two column is changed, request the data for rest columns.")]),s._v("\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("if")]),s._v(" (i < "),a("span",{attrs:{class:"hljs-number"}},[s._v("2")]),s._v(") {\n"),a("span",{attrs:{class:"hljs-comment"}},[s._v("// Mock async load.")]),s._v("\n setTimeout("),a("span",{attrs:{class:"hljs-function"}},[a("span",{attrs:{class:"hljs-params"}},[s._v("()")]),s._v(" =>")]),s._v(" {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("if")]),s._v(" (i === "),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v(") {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("const")]),s._v(" current = asyncData[newIndex]\n current.children = current.children || cityList[current.value]\n current.children["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].children = current.children["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].children || areaList[current.children["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("].value]\n asyncSelectedIndex["),a("span",{attrs:{class:"hljs-number"}},[s._v("1")]),s._v("] = "),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("\n asyncSelectedIndex["),a("span",{attrs:{class:"hljs-number"}},[s._v("2")]),s._v("] = "),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("\n }\n\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("if")]),s._v(" (i === "),a("span",{attrs:{class:"hljs-number"}},[s._v("1")]),s._v(") {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("const")]),s._v(" current = asyncData[asyncSelectedIndex["),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("]].children[newIndex]\n current.children = current.children || areaList[current.value]\n asyncSelectedIndex["),a("span",{attrs:{class:"hljs-number"}},[s._v("2")]),s._v("] = "),a("span",{attrs:{class:"hljs-number"}},[s._v("0")]),s._v("\n }\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".asyncPicker.setData(asyncData, asyncSelectedIndex)\n }, "),a("span",{attrs:{class:"hljs-number"}},[s._v("500")]),s._v(")\n }\n }\n },\n selectHandle(selectedVal, selectedIndex, selectedText) {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createDialog({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("type")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'warn'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("content")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("`Selected Item: <br/> - value: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedVal.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("', '")]),s._v(")}")]),s._v(" <br/> - index: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedIndex.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("', '")]),s._v(")}")]),s._v(" <br/> - text: "),a("span",{attrs:{class:"hljs-subst"}},[s._v("${selectedText.join("),a("span",{attrs:{class:"hljs-string"}},[s._v("' '")]),s._v(")}")]),s._v("`")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("icon")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'cubeic-alert'")]),s._v("\n }).show()\n },\n cancelHandle() {\n"),a("span",{attrs:{class:"hljs-keyword"}},[s._v("this")]),s._v(".$createToast({\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("type")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'correct'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("txt")]),s._v(": "),a("span",{attrs:{class:"hljs-string"}},[s._v("'Picker canceled'")]),s._v(",\n"),a("span",{attrs:{class:"hljs-attr"}},[s._v("time")]),s._v(": "),a("span",{attrs:{class:"hljs-number"}},[s._v("1000")]),s._v("\n }).show()\n }\n }\n}\n")])])])])},function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("table",[a("thead",[a("tr",[a("th",[s._v("Attribute")]),s._v(""),a("th",[s._v("Description")]),s._v(""),a("th",[s._v("Type")]),s._v(""),a("th",[s._v("Accepted Values")]),s._v(""),a("th",[s._v("Default")])])]),s._v(""),a("tbody",[a("tr",[a("td",[s._v("data")]),s._v(""),a("td",[s._v("the cascading data used to init option items")]),s._v(""),a("td",[s._v("Array")]),s._v(""),a("td",[s._v("[]")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("selectedIndex")]),s._v(""),a("td",[s._v("the index of the selected item, corresponding content will be displayed when picker shows")]),s._v(""),a("td",[s._v("Array")]),s._v(""),a("td",[s._v("[]")]),s._v(""),a("td",[s._v("[1]")])]),s._v(""),a("tr",[a("td",[s._v("async"),a("sup",[s._v("1.8.1")])]),s._v(""),a("td",[s._v("async load data")]),s._v(""),a("td",[s._v("Boolean")]),s._v(""),a("td",[s._v("false")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("title")]),s._v(""),a("td",[s._v("title")]),s._v(""),a("td",[s._v("String")]),s._v(""),a("td",[s._v("''")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("subtitle"),a("sup",[s._v("1.8.1")])]),s._v(""),a("td",[s._v("subtitle")]),s._v(""),a("td",[s._v("String")]),s._v(""),a("td",[s._v("''")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("cancelTxt")]),s._v(""),a("td",[s._v("the text of the cancel button")]),s._v(""),a("td",[s._v("String")]),s._v(""),a("td",[s._v("'取消'")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("confirmTxt")]),s._v(""),a("td",[s._v("the text of the confirm button")]),s._v(""),a("td",[s._v("String")]),s._v(""),a("td",[s._v("'确定'")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("swipeTime")]),s._v(""),a("td",[s._v("the duration of the momentum animation when user flicks the wheel of the picker, Unit: ms")]),s._v(""),a("td",[s._v("Number")]),s._v(""),a("td",[s._v("2500")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("alias")]),s._v(""),a("td",[s._v("configure the alias of "),a("code",{pre:!0},[s._v("value")]),s._v(" and "),a("code",{pre:!0},[s._v("text")]),s._v(", used as same as the alias of "),a("code",{pre:!0},[s._v("Picker")]),s._v(" component")]),s._v(""),a("td",[s._v("Object")]),s._v(""),a("td",[s._v("{}")]),s._v(""),a("td",[s._v("{ value: 'id', text: 'name'}")])]),s._v(""),a("tr",[a("td",[s._v("visible"),a("sup",[s._v("1.8.1")])]),s._v(""),a("td",[s._v("whether visible. Bind to "),a("code",{pre:!0},[s._v("v-model")])]),s._v(""),a("td",[s._v("Boolean")]),s._v(""),a("td",[s._v("true/false")]),s._v(""),a("td",[s._v("false")])]),s._v(""),a("tr",[a("td",[s._v("maskClosable"),a("sup",[s._v("1.9.6")])]),s._v(""),a("td",[s._v("whether hide the component when clicked the mask layer")]),s._v(""),a("td",[s._v("Boolean")]),s._v(""),a("td",[s._v("true/false")]),s._v(""),a("td",[s._v("true")])])])])},function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("ul",[a("li",[a("code",{pre:!0},[s._v("data")]),s._v(" sub configuration")])])},function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("table",[a("thead",[a("tr",[a("th",[s._v("Attribute")]),s._v(""),a("th",[s._v("Description")]),s._v(""),a("th",[s._v("Type")]),s._v(""),a("th",[s._v("Default")]),s._v(""),a("th",[s._v("Example")])])]),s._v(""),a("tbody",[a("tr",[a("td",[s._v("text")]),s._v(""),a("td",[s._v("the displayed text of each item")]),s._v(""),a("td",[s._v("String/Number")]),s._v(""),a("td",[s._v("-")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("value")]),s._v(""),a("td",[s._v("the value of each item")]),s._v(""),a("td",[s._v("String/Number/Boolean")]),s._v(""),a("td",[s._v("-")]),s._v(""),a("td",[s._v("-")])])])])},function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("table",[a("thead",[a("tr",[a("th",[s._v("Event Name")]),s._v(""),a("th",[s._v("Description")]),s._v(""),a("th",[s._v("Parameters 1")]),s._v(""),a("th",[s._v("Parameters 2")]),s._v(""),a("th",[s._v("Parameters 3")])])]),s._v(""),a("tbody",[a("tr",[a("td",[s._v("select")]),s._v(""),a("td",[s._v("triggers when clicking the confirm button")]),s._v(""),a("td",[s._v("selectedVal: Array, values of each columns in current selected item")]),s._v(""),a("td",[s._v("selectedIndex: Array, indexes of each columns in current selected item")]),s._v(""),a("td",[s._v("selectedText: Array, texts of each columns in current selected item")])]),s._v(""),a("tr",[a("td",[s._v("change")]),s._v(""),a("td",[s._v("triggers when the roller scrolls")]),s._v(""),a("td",[s._v("index: Number, index of current scrolling roller")]),s._v(""),a("td",[s._v("selectedIndex: Number, index of selected item in current column")]),s._v(""),a("td")]),s._v(""),a("tr",[a("td",[s._v("cancel")]),s._v(""),a("td",[s._v("triggers when clicking the cancel button")]),s._v(""),a("td",[s._v("-")]),s._v(""),a("td",[s._v("-")]),s._v(""),a("td")])])])},function(){vars=this,t=s.$createElement,a=s._self._c||t;returna("table",[a("thead",[a("tr",[a("th",[s._v("Method name")]),s._v(""),a("th",[s._v("Description")]),s._v(""),a("th",[s._v("Parameters 1")]),s._v(""),a("th",[s._v("Parameters 2")])])]),s._v(""),a("tbody",[a("tr",[a("td",[s._v("show")]),s._v(""),a("td",[s._v("show")]),s._v(""),a("td",[s._v("-")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("hide")]),s._v(""),a("td",[s._v("hide")]),s._v(""),a("td",[s._v("-")]),s._v(""),a("td",[s._v("-")])]),s._v(""),a("tr",[a("td",[s._v("setData")]),s._v(""),a("td",[s._v("reset the cascading data and selected index")]),s._v(""),a("td",[s._v("Array, the cascading data")]),s._v(""),a("td",[s._v("Array, the indexes of selected item in each column")])])])])}]}}});