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
02a1db7c
Commit
02a1db7c
authored
Apr 17, 2021
by
李俊赕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表单初始化
parent
8bb7ebba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
131 additions
and
26 deletions
+131
-26
classify.data.js
src/common/classify.data.js
+3
-0
XhInput.vue
src/components/createCom/XhInput.vue
+19
-15
stringMixin.js
src/components/createCom/stringMixin.js
+46
-0
complete.vue
src/pages/order/complete.vue
+63
-11
No files found.
src/common/classify.data.js
View file @
02a1db7c
...
@@ -4,13 +4,16 @@ export default[
...
@@ -4,13 +4,16 @@ export default[
"item"
:
[
"item"
:
[
{
{
"fieldsTitle"
:
"A字裙"
,
"fieldsTitle"
:
"A字裙"
,
"fieldsName"
:
"name"
,
"fieldsType"
:
"input"
,
"fieldsType"
:
"input"
,
"fieldsValue"
:
""
,
"key"
:
"A字裙"
,
"key"
:
"A字裙"
,
"icon"
:
"https://cdn.uviewui.com/uview/common/classify/1/1.jpg"
,
"icon"
:
"https://cdn.uviewui.com/uview/common/classify/1/1.jpg"
,
"cat"
:
10
"cat"
:
10
},
},
{
{
"fieldsTitle"
:
"T恤"
,
"fieldsTitle"
:
"T恤"
,
"fieldsName"
:
"number"
,
"fieldsType"
:
"input"
,
"fieldsType"
:
"input"
,
"key"
:
"T恤"
,
"key"
:
"T恤"
,
"icon"
:
"https://cdn.uviewui.com/uview/common/classify/1/2.jpg"
,
"icon"
:
"https://cdn.uviewui.com/uview/common/classify/1/2.jpg"
,
...
...
src/components/createCom/XhInput.vue
View file @
02a1db7c
<
template
>
<
template
>
<view>
<view>
<u-input
v-model=
"
item.fieldsValu
e"
/>
<u-input
v-model=
"
dataValue"
@
input=
"valueChange"
:type=
"typ
e"
/>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
stringMixin
from
'./stringMixin'
export
default
{
export
default
{
name
:
'xhInput'
,
name
:
'XhInput'
,
// 新建 input
props
:
{
components
:
{},
item
:
{
mixins
:
[
stringMixin
],
type
:
Object
,
props
:
{},
default
()
{
return
null
}
},
},
data
()
{
data
()
{
return
{
return
{}
value
:
''
,
},
type
:
'text'
,
computed
:
{
border
:
true
,
type
()
{
if
(
this
.
item
&&
this
.
item
.
fieldsType
==
'password'
)
{
return
this
.
item
.
fieldsType
}
else
{
return
'text'
}
}
}
}
},
watch
:
{},
mounted
()
{},
methods
:
{}
}
}
</
script
>
</
script
>
...
...
src/components/createCom/stringMixin.js
0 → 100644
View file @
02a1db7c
/** 自定义组件 共同逻辑 */
export
default
{
data
()
{
return
{
dataValue
:
''
}
},
watch
:
{
value
:
function
(
val
)
{
this
.
dataValue
=
val
}
},
props
:
{
value
:
{
type
:
[
String
,
Number
],
default
:
''
},
/** 索引值 用于更新数据 */
itemIndex
:
Number
,
groupIndex
:
Number
,
/** 包含数据源 */
item
:
Object
,
disabled
:
{
type
:
Boolean
,
default
:
false
}
},
mounted
()
{
/** 如果有值以传入值为主 如果无值 已默认值为主 */
this
.
dataValue
=
this
.
value
},
methods
:
{
// 输入的值
valueChange
(
val
)
{
const
data
=
{
groupIndex
:
this
.
groupIndex
,
// 左侧菜单下标
itemIndex
:
this
.
itemIndex
,
//右侧某一项下标
value
:
val
}
this
.
$emit
(
'value-change'
,
data
)
}
}
}
src/pages/order/complete.vue
View file @
02a1db7c
...
@@ -18,15 +18,21 @@
...
@@ -18,15 +18,21 @@
@
scroll=
"rightScroll"
>
@
scroll=
"rightScroll"
>
<u-form
:model=
"form"
ref=
"uForm"
>
<u-form
:model=
"form"
ref=
"uForm"
>
<template
v-for=
"(groupItem,
i
ndex) in groupList"
>
<template
v-for=
"(groupItem,
groupI
ndex) in groupList"
>
<view
class=
"class-item"
:key=
"
i
ndex"
>
<view
class=
"class-item"
:key=
"
groupI
ndex"
>
<view
class=
"title"
>
{{
groupItem
.
groupName
}}
</view>
<view
class=
"title"
>
{{
groupItem
.
groupName
}}
</view>
<view
class=
"class-bd"
>
<view
class=
"class-bd"
>
<u-form-item
:label-width=
"0"
:required=
"groupItem.required"
<u-form-item
:required=
"groupItem.required"
v-for=
"(item,itemIndex) in groupItem.item"
:key=
"itemIndex"
>
v-for=
"(item,itemIndex) in groupItem.item"
:key=
"itemIndex"
<view>
{{
item
.
fieldsTitle
}}
</view>
:prop=
"item.fieldsName"
>
<view
@
click=
"nextStep(item)"
>
{{
item
.
fieldsTitle
}}
</view>
<template
v-if=
"item.fieldsType"
>
<template
v-if=
"item.fieldsType"
>
<xh-input
v-if=
"item.fieldsType==='input'"
v-model=
"form.fieldsName"
></xh-input>
<xh-input
v-if=
"item.fieldsType==='input'"
:groupIndex=
"groupIndex"
:itemIndex=
"itemIndex"
:item=
"item"
@
value-change=
"fieldValueChange"
></xh-input>
</
template
>
</
template
>
</u-form-item>
</u-form-item>
...
@@ -36,6 +42,7 @@
...
@@ -36,6 +42,7 @@
</u-form>
</u-form>
</scroll-view>
</scroll-view>
</view>
</view>
<view
@
click=
"nextStep"
>
下一步
</view>
</view>
</view>
</template>
</template>
<
script
>
<
script
>
...
@@ -50,12 +57,28 @@
...
@@ -50,12 +57,28 @@
menuHeight
:
0
,
// 左边菜单的高度
menuHeight
:
0
,
// 左边菜单的高度
menuItemHeight
:
0
,
// 左边菜单item的高度
menuItemHeight
:
0
,
// 左边菜单item的高度
itemId
:
''
,
// 栏目右边scroll-view用于滚动的id
itemId
:
''
,
// 栏目右边scroll-view用于滚动的id
groupList
:
classifyData
,
groupList
:
classifyData
,
// 基本信息、安装 、勘察(其中一项表单数据)
menuItemPos
:
[],
menuItemPos
:
[],
arr
:
[],
arr
:
[],
scrollRightTop
:
0
,
// 右边栏目scroll-view的滚动条高度
scrollRightTop
:
0
,
// 右边栏目scroll-view的滚动条高度
timer
:
null
,
// 定时器
timer
:
null
,
// 定时器
form
:
{
// 一维表单
name
:
'name'
},
rules
:
{
name
:
[{
required
:
true
,
min
:
10
,
message
:
'姓名不能少于5个字'
,
// 可以单个或者同时写两个触发验证方式
trigger
:
[
'change'
,
'blur'
],
}],
intro
:
[{
min
:
5
,
message
:
'简介不能少于5个字'
,
trigger
:
'change'
}]
}
}
}
},
},
components
:
{
components
:
{
...
@@ -69,11 +92,31 @@
...
@@ -69,11 +92,31 @@
},
},
onReady
()
{
onReady
()
{
this
.
$refs
.
uForm
.
setRules
(
this
.
rules
);
// 导航栏滚动切换
// 导航栏滚动切换
this
.
getMenuItemTop
()
this
.
getMenuItemTop
()
},
},
updated
(){
console
.
log
(
this
.
form
.
name
,
'form.name'
)
},
methods
:
{
methods
:
{
// 字段的值更新
fieldValueChange
(
data
)
{
// data.groupIndex data.itemIndex值下标 data.value //值
console
.
log
(
data
,
'data'
)
const
groupItem
=
this
.
groupList
[
data
.
groupIndex
]
let
innerItem
if
(
groupItem
.
item
){
innerItem
=
groupItem
.
item
[
data
.
itemIndex
]
}
console
.
log
(
innerItem
,
'innerItem'
)
this
.
form
[
innerItem
.
fieldsName
]
=
data
.
value
console
.
log
(
this
.
form
,
'this.form'
)
},
nextStep
(
item
){
// 下一步
console
.
log
(
item
,
'item'
)
},
// ------------------------- 以下方法为展示滚动切换 -------------------------
// ------------------------- 以下方法为展示滚动切换 -------------------------
// 点击左边的栏目切换
// 点击左边的栏目切换
...
@@ -186,6 +229,15 @@
...
@@ -186,6 +229,15 @@
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
// ---------------------------- 表单样式begin ----------------------------
/
deep
/
.u-form-item
{
.u-form-item__message
{
padding-left
:
0
!
important
;
}
}
// ---------------------------- 表单样式end ----------------------------
.u-wrap
{
.u-wrap
{
height
:
calc
(
100vh
);
height
:
calc
(
100vh
);
/* #ifdef H5 */
/* #ifdef H5 */
...
...
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