Skip to content

Commit

Permalink
Select: fix readonly problem in edge (#13034)
Browse files Browse the repository at this point in the history
Cascader select readonly 添加 edge 浏览器判断;
src/utils/util.js 添加 isIE, isEdge方法;
  • Loading branch information
GaliMu authored and ziyoung committed Oct 17, 2018
1 parent ef39757 commit 868bbc7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
5 changes: 2 additions & 3 deletions packages/cascader/src/main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import emitter from 'element-ui/src/mixins/emitter';
import Locale from 'element-ui/src/mixins/locale';
import { t } from 'element-ui/src/locale';
import debounce from 'throttle-debounce/debounce';
import { generateId, escapeRegexpString } from 'element-ui/src/utils/util';
import { generateId, escapeRegexpString, isIE, isEdge } from 'element-ui/src/utils/util';
const popperMixin = {
props: {
Expand Down Expand Up @@ -223,8 +223,7 @@ export default {
return this.disabled || (this.elForm || {}).disabled;
},
readonly() {
const isIE = !this.$isServer && !isNaN(Number(document.documentMode));
return !this.filterable || (!isIE && !this.menuVisible);
return !this.filterable || (!isIE() && !isEdge() && !this.menuVisible);
}
},
Expand Down
6 changes: 2 additions & 4 deletions packages/select/src/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
import { t } from 'element-ui/src/locale';
import scrollIntoView from 'element-ui/src/utils/scroll-into-view';
import { getValueByPath } from 'element-ui/src/utils/util';
import { valueEquals } from 'element-ui/src/utils/util';
import { valueEquals, isIE, isEdge } from 'element-ui/src/utils/util';
import NavigationMixin from './navigation-mixin';
import { isKorean } from 'element-ui/src/utils/shared';
Expand Down Expand Up @@ -180,9 +180,7 @@
},
readonly() {
// trade-off for IE input readonly problem: https://github.com/ElemeFE/element/issues/10403
const isIE = !this.$isServer && !isNaN(Number(document.documentMode));
return !this.filterable || this.multiple || !isIE && !this.visible;
return !this.filterable || this.multiple || (!isIE() && !isEdge() && !this.visible);
},
showClose() {
Expand Down
10 changes: 10 additions & 0 deletions src/utils/util.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Vue from 'vue';

const hasOwnProperty = Object.prototype.hasOwnProperty;

export function noop() {};
Expand Down Expand Up @@ -110,3 +112,11 @@ export const coerceTruthyValueToArray = function(val) {
return [];
}
};

export const isIE = function() {
return !Vue.prototype.$isServer && !isNaN(Number(document.documentMode));
};

export const isEdge = function() {
return !Vue.prototype.$isServer && navigator.userAgent.indexOf('Edge') > -1;
};

0 comments on commit 868bbc7

Please sign in to comment.