Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
self-support
Project
Project
Details
Activity
Releases
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
李俊赕
self-support
Commits
8af49c5a
Commit
8af49c5a
authored
Aug 11, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 完工页面纯数字输入防止粘贴非数字
parent
c4508d5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
36 deletions
+42
-36
stringMixin.js
src/components/createCom/stringMixin.js
+42
-36
No files found.
src/components/createCom/stringMixin.js
View file @
8af49c5a
/** 自定义组件 共同逻辑 */
/** 自定义组件 共同逻辑 */
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
dataValue
:
''
dataValue
:
''
,
}
}
},
watch
:
{
value
:
function
(
val
)
{
this
.
dataValue
=
val
},
},
watch
:
{
},
value
:
function
(
val
)
{
props
:
{
this
.
dataValue
=
val
value
:
{
}
type
:
[
String
,
Number
],
default
:
''
,
},
},
props
:
{
/** 索引值 用于更新数据 */
value
:
{
itemIndex
:
Number
,
type
:
[
String
,
Number
],
groupIndex
:
Number
,
default
:
''
/** 包含数据源 */
},
item
:
Object
,
/** 索引值 用于更新数据 */
disabled
:
{
itemIndex
:
Number
,
type
:
Boolean
,
groupIndex
:
Number
,
default
:
false
,
/** 包含数据源 */
item
:
Object
,
disabled
:
{
type
:
Boolean
,
default
:
false
}
},
},
},
mounted
()
{
mounted
()
{
/** 如果有值以传入值为主 如果无值 已默认值为主 */
/** 如果有值以传入值为主 如果无值 已默认值为主 */
this
.
dataValue
=
this
.
value
this
.
dataValue
=
this
.
value
},
},
methods
:
{
methods
:
{
// 输入的值
// 输入的值
valueChange
(
val
)
{
valueChange
(
val
)
{
const
data
=
{
if
(
this
.
type
==
'digit'
)
{
groupIndex
:
this
.
groupIndex
,
// 左侧菜单下标
// 防止粘贴非数字
itemIndex
:
this
.
itemIndex
,
//右侧某一项下标
val
=
val
.
replace
(
/
[^\d
.
]
/gi
,
''
)
value
:
val
this
.
$nextTick
(()
=>
{
}
this
.
dataValue
=
val
this
.
$emit
(
'value-change'
,
data
)
})
}
}
}
const
data
=
{
groupIndex
:
this
.
groupIndex
,
// 左侧菜单下标
itemIndex
:
this
.
itemIndex
,
//右侧某一项下标
value
:
val
,
}
this
.
$emit
(
'value-change'
,
data
)
},
},
}
}
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