File tree Expand file tree Collapse file tree 4 files changed +44
-1
lines changed
views/host/file-management/process Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 1+ import { App , Directive } from 'vue' ;
2+ import integerInput from './modules/integer' ;
3+
4+ const directivesList : { [ key : string ] : Directive } = {
5+ 'integer-input' : integerInput ,
6+ } ;
7+
8+ const directives = {
9+ install : function ( app : App < Element > ) {
10+ Object . keys ( directivesList ) . forEach ( ( key ) => {
11+ app . directive ( key , directivesList [ key ] ) ;
12+ } ) ;
13+ } ,
14+ } ;
15+
16+ export default directives ;
Original file line number Diff line number Diff line change 1+ import type { Directive , DirectiveBinding } from 'vue' ;
2+
3+ const integerInput : Directive = {
4+ mounted ( el : HTMLElement , binding : DirectiveBinding ) {
5+ const { value } = binding ;
6+ el . addEventListener ( 'input' , ( event : Event ) => {
7+ const inputElement = event . target as HTMLInputElement ;
8+ let inputValue = inputElement . value ;
9+ inputValue = inputValue . replace ( / \. .* / , '' ) ;
10+ if ( value ?. min !== undefined && Number ( inputValue ) < value . min ) {
11+ inputValue = value . min . toString ( ) ;
12+ }
13+ if ( value ?. max !== undefined && Number ( inputValue ) > value . max ) {
14+ inputValue = value . max . toString ( ) ;
15+ }
16+ inputElement . value = inputValue ;
17+ const inputEvent = new Event ( 'input' , { bubbles : true } ) ;
18+ inputElement . dispatchEvent ( inputEvent ) ;
19+ } ) ;
20+ } ,
21+ } ;
22+
23+ export default integerInput ;
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ import hljsVuePlugin from '@highlightjs/vue-plugin';
2828import 'vue-virtual-scroller/dist/vue-virtual-scroller.css' ;
2929import VirtualScroller from 'vue-virtual-scroller' ;
3030
31+ import directives from '@/directives/index' ;
32+
3133const app = createApp ( App ) ;
3234app . use ( hljsVuePlugin ) ;
3335app . component ( 'SvgIcon' , SvgIcon ) ;
@@ -43,4 +45,6 @@ app.use(router);
4345app . use ( i18n ) ;
4446app . use ( pinia ) ;
4547app . use ( Components ) ;
48+ app . use ( directives ) ;
49+
4650app . mount ( '#app' ) ;
Original file line number Diff line number Diff line change 2424 </div >
2525 <div class =" w-full" >
2626 <el-progress
27- v-if =" value.total === 0"
27+ v-if =" value.total === 0 && value.percent != 100 "
2828 :percentage =" 100"
2929 :indeterminate =" true"
3030 :duration =" 1"
You can’t perform that action at this time.
0 commit comments