Parcourir la source

'兼容IE10下不进入quill组件'

lin-xin il y a 7 ans
Parent
commit
34a4fd4b4f
2 fichiers modifiés avec 11 ajouts et 2 suppressions
  1. 2 0
      README.md
  2. 9 2
      src/main.js

+ 2 - 0
README.md

@@ -128,6 +128,8 @@ vue.js封装sChart.js的图表组件。访问地址:[vue-schart](https://githu
 ### Vue-Quill-Editor ###
 基于Quill、适用于Vue2的富文本编辑器。访问地址:[vue-quill-editor](https://github.com/surmon-china/vue-quill-editor)
 
+(IE10及以下不支持)
+
 ### mavonEditor ###
 基于Vue的markdown编辑器。访问地址:[mavonEditor](https://github.com/hinesboy/mavonEditor)
 

+ 9 - 2
src/main.js

@@ -17,10 +17,17 @@ router.beforeEach((to, from, next) => {
         // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已
         role === 'admin' ? next() : next('/login');
     }else{
-        next();
+        // 简单的判断IE10及以下不进入富文本编辑器,该组件不兼容
+        if(navigator.userAgent.indexOf('MSIE') && to.path === '/editor'){
+            Vue.prototype.$alert('vue-quill-editor组件不兼容IE10及以下浏览器,请使用更高版本的浏览器查看', '浏览器不兼容通知', {
+                confirmButtonText: '确定'
+            });
+        }else{
+            next();
+        }
     }
 })
-
+console.log(navigator.userAgent);
 new Vue({
     router,
     render: h => h(App)