<select ms-controller="vmdtype"
id="dtype" ms-duplex="@selected">
<option ms-for="el in @options" ms-attr="{value:el.dtype}">{{el.dtypename}}</option>
</select>
var dtype = avalon.define({
$id : 'vmdtype',
selected : "",
options : [],
loadtype : function() {
$.ajax({
url : getPath + '/aa/querydType.do',
async : false,
cache : false,
type : 'post',
dataType : 'json',
success : function(data) {
dtype.options = [];
dtype.options = data.data;
dtype.options.unshift({
id : -1,
dtype : "",
dtypename : "",
});
dtype.selected="aaaa";//设置默认值
}
});
},
});
问题描述:代码如上,为什么设置select的默认选中项没有用?即dtype.selected="aaaa";//设置默认值这句没起作用。在线等,急