mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-20 00:06:45 +08:00
教师端1期问题修复
This commit is contained in:
18
src/main.js
18
src/main.js
@@ -19,6 +19,24 @@ Vue.use(vueKatexEs,{
|
||||
}
|
||||
})
|
||||
|
||||
Vue.directive('limit-input', {
|
||||
bind: function (el, binding) {
|
||||
const max = binding.value || 50;
|
||||
// 找到input元素
|
||||
const input = el.querySelector('input');
|
||||
if (input) {
|
||||
// 监听input事件,在输入时限制长度
|
||||
input.addEventListener('input', function () {
|
||||
if (input.value.length > max) {
|
||||
input.value = input.value.substring(0, max);
|
||||
// 触发input事件,让element-ui的内部处理更新
|
||||
input.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//import './mock/index'
|
||||
|
||||
import xpage from '@/utils/xpage'
|
||||
|
||||
Reference in New Issue
Block a user