【新增】插件git同步模块,用于同步项目内容,加速项目开发

【调整】前端暗色问题
This commit is contained in:
chudong
2025-05-14 16:50:56 +08:00
parent dc43da936b
commit e6947ec5c4
215 changed files with 19918 additions and 9710 deletions

View File

@@ -0,0 +1,33 @@
import { App, Directive, DirectiveBinding } from 'vue'
/**
* 移除输入框中的空格
* 用法v-nospace
*/
export const vNospace: Directive = {
mounted(el: HTMLElement, binding: DirectiveBinding) {
el.addEventListener('input', (event: Event) => {
const inputElement = event.target as HTMLInputElement
const newValue = inputElement.value.replace(/\s+/g, '')
// 直接设置输入元素的值
if (inputElement.value !== newValue) {
inputElement.value = newValue
// 触发自定义事件,通知父组件值已更改
el.dispatchEvent(new Event('input', { bubbles: true }))
}
})
},
}
// 导出所有指令的集合,方便批量注册
export const directives = {
nospace: vNospace,
}
// 注册所有指令
export const useDirectives = (app: App, directives: Record<string, Directive>) => {
Object.entries(directives).forEach(([key, value]) => {
app.directive(key, value)
})
}