Commit aa02b420 authored by Leopoldthecoder's avatar Leopoldthecoder Committed by 杨奕

Radio: fix console error of RadioGroup

parent cbfd9cfa
...@@ -53,9 +53,10 @@ ...@@ -53,9 +53,10 @@
}, },
mounted() { mounted() {
// 当radioGroup没有默认选项时,第一个可以选中Tab导航 // 当radioGroup没有默认选项时,第一个可以选中Tab导航
let radios = this.$el.querySelectorAll('[type=radio]'); const radios = this.$el.querySelectorAll('[type=radio]');
if (![].some.call(radios, radio => radio.checked)) { const firstLabel = this.$el.querySelectorAll('[role=radio]')[0];
this.$el.querySelectorAll('[role=radio]')[0].tabIndex = 0; if (![].some.call(radios, radio => radio.checked) && firstLabel) {
firstLabel.tabIndex = 0;
} }
}, },
methods: { methods: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment