Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vue-gjjs
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fukai
vue-gjjs
Commits
ba51dd98
Commit
ba51dd98
authored
Nov 03, 2023
by
yangxiaolei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inputCurrency 增加依赖收集功能
parent
169002c7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
4 deletions
+119
-4
Input.vue
src/components/Input.vue
+6
-1
InputCurrency.vue
src/components/InputCurrency.vue
+59
-1
InputNumber.vue
src/components/InputNumber.vue
+54
-2
No files found.
src/components/Input.vue
View file @
ba51dd98
<
template
>
<el-input
:class=
"
{'redClass':red
&&
isDis
able
}" v-storeModify :id="id" ref="form-item" v-model="model" v-bind="attrs" v-on="$listeners" v-bind:disabled="isDisable">
<el-input
:class=
"
{'redClass':red
&&
isDis
play
}" v-storeModify :id="id" ref="form-item" v-model="model" v-bind="attrs" v-on="$listeners" v-bind:disabled="isDisable">
<template
v-slot:suffix
>
<slot
name=
"suffix"
></slot>
</
template
>
...
...
@@ -76,6 +76,11 @@ export default {
return
this
.
mode
===
'display'
||
this
.
disabled
}
},
isDisplay
:
{
get
()
{
return
this
.
mode
===
'display'
}
},
highlight
()
{
return
this
.
$store
.
state
.
Status
.
highlights
.
indexOf
(
this
.
id
)
!==
-
1
},
...
...
src/components/InputCurrency.vue
View file @
ba51dd98
<
template
>
<el-input
:id=
"id"
v-storeModify
:class=
"
{'redClass':isDisplay
&&
isDisable}"
ref="form-item"
class="m-input-currency"
v-model="model"
...
...
@@ -15,6 +17,44 @@
<
script
>
import
BigNumber
from
"bignumber.js"
;
export
default
{
inject
:
[
"root"
],
directives
:{
storeModify
:{
update
(
el
,
bind
,
vnode
){
let
_this
=
vnode
.
context
let
key
=
vnode
.
parent
.
data
.
model
.
expression
let
keyArray
=
key
.
split
(
'.'
)
let
curKey
=
keyArray
.
pop
()
let
resultKey
=
keyArray
.
join
(
"."
)
let
deepData
=
_this
.
getProperty
(
resultKey
,
_this
.
root
)
if
(
deepData
&&
Array
.
isArray
(
deepData
.
modifySet
)){
if
(
deepData
.
modifySet
.
includes
(
curKey
)){
_this
.
red
=
true
}
}
el
.
onchange
=
(...
args
)
=>
{
console
.
log
(
"12"
)
if
(
deepData
.
modifySet
){
if
(
Array
.
isArray
(
deepData
.
modifySet
)){
if
(
deepData
.
modifySet
.
includes
(
curKey
)){
return
}
deepData
.
modifySet
.
push
(
curKey
)
}
}
else
{
deepData
.
modifySet
=
[
curKey
]
}
}
}
}
},
data
(){
return
{
red
:
false
}
},
props
:
{
value
:
{
type
:
[
String
,
Number
],
...
...
@@ -69,6 +109,11 @@ export default {
get
()
{
return
this
.
mode
===
"display"
||
this
.
disabled
;
}
},
isDisplay
:
{
get
()
{
return
this
.
mode
===
'display'
}
}
},
methods
:
{
...
...
@@ -153,6 +198,15 @@ export default {
}
return
this
.
value
;
},
getProperty
(
str
,
value
)
{
let
keys
=
str
?.
split
(
'.'
)
for
(
let
key
of
keys
)
{
if
(
value
)
{
value
=
value
[
key
]
}
}
return
value
},
formatValue
(
value
)
{
if
(
value
!==
null
&&
value
!==
undefined
&&
value
.
toString
)
{
var
temp
=
value
...
...
@@ -211,7 +265,11 @@ export default {
};
</
script
>
<
style
>
<
style
lang=
"less"
scoped
>
.redClass
/
deep
/
.el-input__inner
{
border-color
:
red
;
}
/* .el-input.highlight .el-input__inner{
border-color: red;
} */
...
...
src/components/InputNumber.vue
View file @
ba51dd98
<
template
>
<el-input-number
:id=
"id"
:class=
"
{'highlight': highlight
}" ref="form-item" v-model="model" :controls="false" v-bind="$attrs" v-on="$listeners" v-bind:disabled="isDisable"/>
<el-input-number
:id=
"id"
v-storeModify
:class=
"
{'highlight': highlight,'redClass':red
&&
isDisable
}" ref="form-item" v-model="model" :controls="false" v-bind="$attrs" v-on="$listeners" v-bind:disabled="isDisable"/>
</
template
>
<
script
>
export
default
{
inject
:
[
"root"
],
directives
:{
storeModify
:{
update
(
el
,
bind
,
vnode
){
let
_this
=
vnode
.
context
let
key
=
vnode
.
parent
.
data
.
model
.
expression
let
keyArray
=
key
.
split
(
'.'
)
let
curKey
=
keyArray
.
pop
()
let
resultKey
=
keyArray
.
join
(
"."
)
let
deepData
=
_this
.
getProperty
(
resultKey
,
_this
.
root
)
if
(
deepData
&&
Array
.
isArray
(
deepData
.
modifySet
)){
if
(
deepData
.
modifySet
.
includes
(
curKey
)){
_this
.
red
=
true
}
}
el
.
onchange
=
(...
args
)
=>
{
if
(
deepData
.
modifySet
){
if
(
Array
.
isArray
(
deepData
.
modifySet
)){
if
(
deepData
.
modifySet
.
includes
(
curKey
)){
return
}
deepData
.
modifySet
.
push
(
curKey
)
}
}
else
{
deepData
.
modifySet
=
[
curKey
]
}
}
}
}
},
data
(){
return
{
red
:
false
}
},
props
:
{
value
:
{
type
:
Number
,
...
...
@@ -38,14 +75,28 @@ export default {
highlight
()
{
return
this
.
$store
.
state
.
Status
.
highlights
.
indexOf
(
this
.
id
)
!==
-
1
}
},
methods
:{
getProperty
(
str
,
value
)
{
let
keys
=
str
?.
split
(
'.'
)
for
(
let
key
of
keys
)
{
if
(
value
)
{
value
=
value
[
key
]
}
}
return
value
}
}
}
</
script
>
<
style
scope
>
<
style
lang=
"less"
scoped
>
.el-input-number
.el-input__inner
{
text-align
:
left
;
}
.el-input.highlight
.el-input__inner
{
border-color
:
red
;
}
.redClass
/
deep
/
.el-input__inner
{
border-color
:
red
;
}
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment