Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uview-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李晖
uview-ui
Commits
01156d43
Commit
01156d43
authored
Sep 10, 2020
by
wlxuqu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 优化search组件的maxlength下的问题
2. 修复radio组件的change时间不触发的问题
parent
15f867f9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
31 deletions
+29
-31
pages.json
pages.json
+1
-1
index.vue
pages/componentsC/test/index.vue
+25
-19
u-radio.vue
uview-ui/components/u-radio/u-radio.vue
+1
-5
u-search.vue
uview-ui/components/u-search/u-search.vue
+2
-6
No files found.
pages.json
View file @
01156d43
...
...
@@ -6,7 +6,7 @@
"current"
:
0
,
//当前激活的模式(list
的索引项)
"list"
:
[{
"name"
:
"test"
,
//模式名称
"path"
:
"pages/components
C/test
/index"
,
//启动页面,必选
"path"
:
"pages/components
B/search
/index"
,
//启动页面,必选
"query"
:
"id=1&name=2"
//启动参数,在页面的onLoad函数里面得到
}]
},
...
...
pages/componentsC/test/index.vue
View file @
01156d43
<
template
>
<view
class=
""
>
<u-radio-group
v-model=
"value"
@
change=
"radioGroupChange"
>
<u-radio
@
change=
"radioChange"
<u-checkbox-group
@
change=
"checkboxGroupChange"
>
<u-checkbox
@
change=
"checkboxChange"
v-model=
"item.checked"
v-for=
"(item, index) in list"
:key=
"index"
:name=
"item.name"
:disabled=
"item.disabled"
>
{{
item
.
name
}}
</u-radio>
</u-radio-group>
>
{{
item
.
name
}}
</u-checkbox>
</u-checkbox-group>
<u-button
@
click=
"checkedAll"
>
全选
</u-button>
</view>
</
template
>
...
...
@@ -19,30 +18,37 @@ export default {
return
{
list
:
[
{
name
:
1
,
name
:
'
apple
'
,
checked
:
false
,
disabled
:
false
},
{
name
:
2
,
name
:
'
banner
'
,
checked
:
false
,
disabled
:
false
},
{
name
:
3
,
name
:
'
orange
'
,
checked
:
false
,
disabled
:
false
}
],
// u-radio-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
value
:
1
,
]
};
},
methods
:
{
// 选中某个
单选框时,由radio
时触发
radio
Change
(
e
)
{
//
console.log(e);
// 选中某个
复选框时,由checkbox
时触发
checkbox
Change
(
e
)
{
console
.
log
(
e
);
},
// 选中任一
radio时,由radio
-group触发
radio
GroupChange
(
e
)
{
// 选中任一
checkbox时,由checkbox
-group触发
checkbox
GroupChange
(
e
)
{
// console.log(e);
},
// 全选
checkedAll
()
{
this
.
list
.
map
(
val
=>
{
val
.
checked
=
true
;
})
}
}
};
...
...
uview-ui/components/u-radio/u-radio.vue
View file @
01156d43
...
...
@@ -183,11 +183,7 @@
},
emitEvent
()
{
// u-radio的name不等于父组件的v-model的值时(意味着未选中),才发出事件,避免多次点击触发事件
// 等待下一个周期再执行,因为this.$emit('input')作用于父组件,再反馈到子组件内部,需要时间
// 头条需要延时的时间比较长,这里给比较大的值
setTimeout
(()
=>
{
if
(
this
.
parentData
.
value
!=
this
.
name
)
this
.
$emit
(
'
change
'
,
this
.
name
);
},
80
);
if
(
this
.
parentData
.
value
!=
this
.
name
)
this
.
$emit
(
'
change
'
,
this
.
name
);
},
// 改变组件选中状态
// 这里的改变的依据是,更改本组件的parentData.value值为本组件的name值,同时通过父组件遍历所有u-radio实例
...
...
uview-ui/components/u-search/u-search.vue
View file @
01156d43
...
...
@@ -22,8 +22,8 @@
@
input=
"inputChange"
:disabled=
"disabled"
@
focus=
"getFocus"
:maxlength=
"getMaxlength"
:focus=
"focus"
:maxlength=
"maxlength"
placeholder-class=
"u-placeholder-class"
:placeholder=
"placeholder"
:placeholder-style=
"`color: $
{placeholderColor}`"
...
...
@@ -164,7 +164,7 @@ export default {
// 输入框最大能输入的长度,-1为不限制长度(来自uniapp文档)
maxlength
:
{
type
:
[
Number
,
String
],
default
:
-
1
default
:
'
-1
'
},
// 搜索图标的颜色,默认同输入框字体颜色
searchIconColor
:
{
...
...
@@ -227,10 +227,6 @@ export default {
if
(
this
.
borderColor
)
return
`1px solid
${
this
.
borderColor
}
`
;
else
return
'
none
'
;
},
// 将maxlength转为数值
getMaxlength
()
{
return
Number
(
this
.
maxlength
);
}
},
methods
:
{
// 目前HX2.6.9 v-model双向绑定无效,故监听input事件获取输入框内容的变化
...
...
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