cascader 动态加载 回显_elementUI的cascader级联选择控件的默认值(回显)问题

其实所谓回显,也只是默认值的问题。例如,一个省市联动,如果当一个用户修改自己信息的时候,那么他能看到级联选择的值,也就是说

在修改页面我们给级联选择器赋值一个默认值就可以了。截图是官方文档

vchl0ru49s7kzokjrl7nysejrm7ssao05rxedxnlcrbuz/pa77xeywrkcmvzc8rh0ru49nn0cmluz8dg0m21xkosz+u1sci7tcs+zbiz1rw4+mhlxkziz7xeb3b0aw9uc6osywxlcns1r7p2z9tkvrxe0rlkx1sxldi0ldvdo6y40l71w7vjts7kzokjrl/jysdjb25zb2xllmxvzygpv7tk/b7dtcs48cq9o7vy1d+4/naxvdo142fszxj0khr5cgvvzibhzgryzxnzkbty06gz9sc0tctk/b7dwodqzc6qc3ryaw5no6zt2srhzsrm4txstb3by6gjpgjyic8+dqq9q9fwt/u0rrhkzqrk/dfpulpwtbj4xkziz7xeb3b0aw9uo6ziu7rzz9tkvqosvs3q0mhloapoysziysejrmrxz8jo0sphtctktczlwodw0ltmtkk1xmrhu3ryaw5no6yyu7/jxnzs8s6qx7c2y9do0qq+zb2ryrxm5cdgupi4xmhlo6zl+dlu1ela79a7xny688yovdo1vcr9vt2jrmi7uvo3tbvyupjhslblo6zhslbl1nnew7w9yv2+3dta16q7u7pjyv3x6biz1rw4+g9wdglvbqgjpc9wpg0kpha+0n64xle9t6ijujwvcd4ncjxwpreo0rujuqoosci9z8lpt7ojrlwryse8ulr1ysfn8stctcsjrmv509c1xla8v8ns1nequ7uzycr91+mjqtxiciavpg0k0vloqsr91+nkx3n0cmluz8dg0m21xly0iczszhf1bztbmswyncw1xszyzhf1bzs8yniglz4ncjghor2rjnjkcxvvo1smcmrxdw87ilrniczszhf1bztdjnjkcxvvoyasc3vic3ryaw5npgjyic8+dqoyoak9q7xdtb21xnfwt/u0rnnwbgl0kczszhf1bzssjnjkcxvvoykstco1vdk7upbxsnpqjmxkcxvvozemcmrxdw87o6wmbgrxdw87mjqmcmrxdw87o6wmbgrxdw87nszyzhf1bzu1xhn0cmluz8r91+k8yniglz4ncjohotgtu7few7p2yv3x6bxew7+49tsqy9jxqru7s8lpbnta4ndno6zu2xb1c2i1vw9wdglvbsr91+na7zxiciavpg0kt6i2/qo6pgjyic8+dqrs1mewztk2vmrh08o3qnk7o6y1q8rhzkvc6bezwcujrlrzwltsu8/ranpa77k7ysft0lj2slnptslwo6zo0r2r19a3+7su1rg909equ7uzywpzb2621m/zo6w8yniglz4ncmpzb2674bj5vt3x1rf7tk61xljxyr2w787sw8fwxrav16q7u7pjz+dtprxeuphkvaos1k3a7b7nyscmcmrxdw87wzesmjqsnv0mcmrxdw87ilxejnjkcxvvo1smcmrxdw87ilrniczszhf1bztdjnjkcxvvo6osuvpmqlspuf3atlxeyv2+3wpzb27x1rf7tk6jrgpzb27u2tequ7uzybbuz/o1xmqxuvkjrlvhupm+3dxiob6hvydf0lbpy/vkx8r91+m2+lfhxutl+8dg0m2jrnpaysfo0sphvs3wsb3t16qzycr91+nby6os1rvsqtk70nc0+slroam8l3a+dqo8chjlignsyxnzpq=="brush:sql;">

app.selectedoptions=json.parse(str);

下面是我的部分代码

html:

js:

selectedoptions:[],

$.ajax({

type:"get",

url:this.api.userdata+"?id="+result,

datetype:"json",

contenttype : 'application/json',

success:function(result){

app.user=result.data;

app.selectedoptions=json.parse(result.data.useraddress);

},

error:function(result){

}

});

运行结果:

ps:以后写代码还是要多思考,虽然有些功能能实现,但是要在功能实现过后想一想是否更简单的做法。

如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!

你可能感兴趣的:(cascader,动态加载,回显)