New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avalon2.11联动选择在IE8及以下报错 #1531

Closed
liu99990309 opened this Issue Jun 28, 2016 · 3 comments

Comments

Projects
None yet
3 participants
@liu99990309

liu99990309 commented Jun 28, 2016

/ * built in 2016-6-27:14 version 2.11 by 司徒正美 * /

  <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="avalon.js"></script>
</head>
<body ms-controller="test">
    <script>
        var list = [{
            "id": 101,
            "name": "器乐",
            "parentId": null,
            "orderNum": 1,
            "icon": null,
            "subCategories": [{
                "id": 1001,
                "name": "钢琴",
                "parentId": 101,
                "orderNum": 1,
                "icon": null,
                "subCategories": null
            }, {
                "id": 1011058,
                "name": "手风琴",
                "parentId": 101,
                "orderNum": 1,
                "icon": null,
                "subCategories": null
            }]
        }, {
            "id": 103,
            "name": "舞蹈",
            "parentId": null,
            "orderNum": 3,
            "icon": null,
            "subCategories": [{
                "id": 1032,
                "name": "中国舞",
                "parentId": 103,
                "orderNum": 1,
                "icon": null,
                "subCategories": null
            }, {
                "id": 1033,
                "name": "芭蕾舞",
                "parentId": 103,
                "orderNum": 1,
                "icon": null,
                "subCategories": null
            }]
        }, {
            "id": 107,
            "name": "音乐理论",
            "parentId": null,
            "orderNum": 7,
            "icon": null,
            "subCategories": [{
                "id": 1054,
                "name": "乐理",
                "parentId": 107,
                "orderNum": 1,
                "icon": null,
                "subCategories": null
            }]
        }, {
            "id": 108,
            "name": "棋类",
            "parentId": null,
            "orderNum": 8,
            "icon": null,
            "subCategories": [{
                "id": 1058,
                "name": "国际象棋",
                "parentId": 108,
                "orderNum": 1,
                "icon": null,
                "subCategories": null
            }, {
                "id": 1059,
                "name": "围棋",
                "parentId": 108,
                "orderNum": 1,
                "icon": null,
                "subCategories": null
            }]
        }, {
            "id": 1011059,
            "name": "高考艺培",
            "parentId": null,
            "orderNum": 10,
            "icon": null,
            "subCategories": [{
                "id": 1011060,
                "name": "编导",
                "parentId": 1011059,
                "orderNum": 1,
                "icon": null,
                "subCategories": null
            }, {
                "id": 1011061,
                "name": "播音主持",
                "parentId": 1011059,
                "orderNum": 2,
                "icon": null,
                "subCategories": null
            }]
        }]

        var vm=avalon.define({
            $id:'test',
            level1:'',
            arr1:list,
            level2:'',
            arr2:[]
        })   



         vm.$watch('level1',function(val){
        if (val) {
            var n;
            for (var i = 0, l = vm.arr1.length; i < l; i++) {
                n = vm.arr1[i];
                if (n.id == val) {           
                    vm.arr2 = n.subCategories;
                    return;
                }
            }
        }
    })
    </script>
    <select ms-duplex="@level1">
        <option value="">请选择</option>
        <option ms-for="el in @arr1" ms-attr="{value:el.id}">{{el.name}}</option>
    </select>
    <select ms-duplex="@level2">
        <option value="">请选择</option>
        <option ms-for="el in @arr2" ms-attr="{value:el.id}">{{el.name}}</option>
    </select>
</body>
</html>

image2

@liu99990309 liu99990309 reopened this Jun 28, 2016

@liu99990309

This comment has been minimized.

Show comment
Hide comment
@liu99990309

liu99990309 Jun 28, 2016

vm.arr2 = n.subCategories.$model;

这样写就不出错了,
n.subCategories被转成了vm对象,IE8下直接赋值就报错了。

liu99990309 commented Jun 28, 2016

vm.arr2 = n.subCategories.$model;

这样写就不出错了,
n.subCategories被转成了vm对象,IE8下直接赋值就报错了。

@RubyLouvre

This comment has been minimized.

Show comment
Hide comment
@RubyLouvre

RubyLouvre Jun 28, 2016

Owner

是的,不能将vm赋给vm

Owner

RubyLouvre commented Jun 28, 2016

是的,不能将vm赋给vm

@RubyLouvre RubyLouvre closed this Jun 28, 2016

@whm-js

This comment has been minimized.

Show comment
Hide comment
@whm-js

whm-js Jul 7, 2016

var list = [{
"id": 101,
"name": "器乐",
"parentId": null,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}]
}, {
"id": 103,
"name": "舞蹈",
"parentId": null,
"orderNum": 3,
"icon": null,
"subCategories": [{
"id": 1032,
"name": "中国舞",
"parentId": 103,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1033,
"name": "芭蕾舞",
"parentId": 103,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}]
}, {
"id": 107,
"name": "音乐理论",
"parentId": null,
"orderNum": 7,
"icon": null,
"subCategories": null
}, {
"id": 108,
"name": "棋类",
"parentId": null,
"orderNum": 8,
"icon": null,
"subCategories": [{
"id": 1058,
"name": "国际象棋",
"parentId": 108,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}, {
"id": 1059,
"name": "围棋",
"parentId": 108,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}]
}, {
"id": 1011059,
"name": "高考艺培",
"parentId": null,
"orderNum": 10,
"icon": null,
"subCategories": [{
"id": 1011060,
"name": "编导",
"parentId": 1011059,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}, {
"id": 1011061,
"name": "播音主持",
"parentId": 1011059,
"orderNum": 2,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}]
}]
我多加了几级的数据在ie8下多选几次就出错了

whm-js commented Jul 7, 2016

var list = [{
"id": 101,
"name": "器乐",
"parentId": null,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}]
}, {
"id": 103,
"name": "舞蹈",
"parentId": null,
"orderNum": 3,
"icon": null,
"subCategories": [{
"id": 1032,
"name": "中国舞",
"parentId": 103,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1033,
"name": "芭蕾舞",
"parentId": 103,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}]
}, {
"id": 107,
"name": "音乐理论",
"parentId": null,
"orderNum": 7,
"icon": null,
"subCategories": null
}, {
"id": 108,
"name": "棋类",
"parentId": null,
"orderNum": 8,
"icon": null,
"subCategories": [{
"id": 1058,
"name": "国际象棋",
"parentId": 108,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}, {
"id": 1059,
"name": "围棋",
"parentId": 108,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}]
}, {
"id": 1011059,
"name": "高考艺培",
"parentId": null,
"orderNum": 10,
"icon": null,
"subCategories": [{
"id": 1011060,
"name": "编导",
"parentId": 1011059,
"orderNum": 1,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}, {
"id": 1011061,
"name": "播音主持",
"parentId": 1011059,
"orderNum": 2,
"icon": null,
"subCategories": [{
"id": 1001,
"name": "钢琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}, {
"id": 1011058,
"name": "手风琴",
"parentId": 101,
"orderNum": 1,
"icon": null,
"subCategories": null
}]
}]
}]
我多加了几级的数据在ie8下多选几次就出错了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment