Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
3944651f
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3944651f
编写于
9月 04, 2023
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: button、input-data.vue
上级
20d084de
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
116 addition
and
107 deletion
+116
-107
components/input-data/input-data.vue
components/input-data/input-data.vue
+107
-98
pages/component/button/button.uvue
pages/component/button/button.uvue
+9
-9
未找到文件。
components/input-data/input-data.vue
浏览文件 @
3944651f
<
script
lang=
"uts"
>
export
default
{
name
:
"
input-data
"
,
props
:
{
title
:
{
type
:
String
,
required
:
true
},
type
:
{
type
:
String
,
required
:
true
},
defaultValue
:
{
type
:
String
,
required
:
true
,
default
:
''
}
},
data
()
{
return
{
inputClearValue
:
''
as
any
,
showClearIcon
:
false
,
inputType
:
'
text
'
}
},
created
()
{
switch
(
this
.
type
)
{
case
'
number
'
:
this
.
inputType
=
'
number
'
break
;
}
this
.
inputClearValue
=
this
.
getValue
(
this
.
defaultValue
)
},
methods
:
{
input
:
function
(
event
:
InputEvent
)
{
// @ts-ignore
this
.
inputClearValue
=
event
.
detail
.
value
if
((
this
.
inputClearValue
as
string
).
length
>
0
)
{
this
.
showClearIcon
=
true
}
else
{
this
.
showClearIcon
=
false
}
export
default
{
name
:
"
input-data
"
,
props
:
{
title
:
{
type
:
String
,
required
:
true
},
type
:
{
type
:
String
,
required
:
true
},
defaultValue
:
{
type
:
String
,
required
:
true
,
default
:
''
}
},
data
()
{
return
{
inputClearValue
:
''
as
any
,
showClearIcon
:
false
,
inputType
:
'
text
'
}
},
created
()
{
switch
(
this
.
type
)
{
case
'
number
'
:
this
.
inputType
=
'
number
'
break
;
}
this
.
inputClearValue
=
this
.
getValue
(
this
.
defaultValue
)
},
methods
:
{
input
:
function
(
event
:
InputEvent
)
{
// @ts-ignore
this
.
inputClearValue
=
event
.
detail
.
value
if
((
this
.
inputClearValue
as
string
).
length
>
0
)
{
this
.
showClearIcon
=
true
}
else
{
this
.
showClearIcon
=
false
}
this
.
$emit
(
'
confirm
'
,
this
.
getValue
(
this
.
inputClearValue
))
},
clearIcon
:
function
()
{
this
.
inputClearValue
=
''
this
.
showClearIcon
=
false
},
// @ts-ignore
confirm
(
e
:
InputConfirmEvent
)
{
// this.$emit('confirm', this.getValue(e.detail.value))
},
blur
()
{
this
.
showClearIcon
=
false
},
focus
()
{
let
inputValue
=
this
.
inputClearValue
if
(
typeof
inputValue
!==
'
string
'
)
{
inputValue
=
inputValue
.
toString
()
}
if
((
inputValue
as
string
).
length
>
0
)
{
this
.
showClearIcon
=
true
}
else
{
this
.
showClearIcon
=
false
}
},
getValue
(
value
:
any
)
:
any
{
switch
(
this
.
type
)
{
case
'
number
'
:
return
parseFloat
(
value
as
string
)
}
this
.
$emit
(
'
confirm
'
,
this
.
getValue
(
this
.
inputClearValue
))
},
clearIcon
:
function
()
{
this
.
inputClearValue
=
''
this
.
showClearIcon
=
false
this
.
$emit
(
'
confirm
'
,
this
.
getValue
(
this
.
inputClearValue
))
},
// @ts-ignore
confirm
(
e
:
InputConfirmEvent
)
{
// this.$emit('confirm', this.getValue(e.detail.value))
},
blur
()
{
this
.
showClearIcon
=
false
},
focus
()
{
let
inputValue
=
this
.
inputClearValue
if
(
typeof
inputValue
!==
'
string
'
)
{
inputValue
=
inputValue
.
toString
()
}
if
((
inputValue
as
string
).
length
>
0
)
{
this
.
showClearIcon
=
true
}
else
{
this
.
showClearIcon
=
false
}
},
getValue
(
value
:
any
)
:
any
{
switch
(
this
.
type
)
{
case
'
number
'
:
return
parseFloat
(
value
as
string
)
}
return
value
}
}
}
return
value
}
}
}
</
script
>
<
template
>
<view
class=
"uni-padding-wrap"
>
<view
class=
"uni-title uni-common-mt"
>
<text
class=
"uni-title-text"
>
{{
title
}}
</text>
</view>
</view>
<view
class=
"uni-input-wrapper input-wrapper"
>
<input
class=
"uni-input"
:type=
"inputType"
:value=
"inputClearValue"
:placeholder=
"title"
@
input=
"input"
@
confirm=
"confirm"
@
blur=
"blur"
@
focus=
"focus"
/>
<image
class=
"input-wrapper_image"
src=
"/static/icons/clear.png"
v-if=
"showClearIcon"
@
click=
"clearIcon"
>
</image>
</view>
<view
class=
"uni-padding-wrap"
>
<view
class=
"uni-title uni-common-mt"
>
<text
class=
"uni-title-text"
>
{{
title
}}
</text>
</view>
</view>
<view
class=
"uni-input-wrapper input-wrapper"
>
<input
class=
"uni-input"
:type=
"inputType"
:value=
"inputClearValue"
:placeholder=
"title"
@
input=
"input"
@
confirm=
"confirm"
@
blur=
"blur"
@
focus=
"focus"
/>
<image
class=
"input-wrapper_image"
src=
"/static/icons/clear.png"
v-if=
"showClearIcon"
@
click=
"clearIcon"
>
</image>
</view>
</
template
>
<
style
>
.
input-wrapper
{
border
:
1px
solid
rgba
(
0
,
0
,
0
,
.08
)
;
justify-content
:
center
;
padding
:
0
;
margin
:
0
20
rpx
;
background-color
:
#FFF
;
}
.uni-
input-wrapper
{
padding
:
8px
13px
;
margin
:
10
rpx
0
;
flex-direction
:
row
;
flex-wrap
:
nowrap
;
background-color
:
#ffffff
;
}
.input-wrapper_image
{
width
:
22px
;
height
:
22px
;
align-self
:
center
;
margin-right
:
10
rpx
;
}
.input-wrapper
{
border
:
1px
solid
rgba
(
0
,
0
,
0
,
.08
);
flex-direction
:
row
;
justify-content
:
center
;
padding
:
0
;
margin
:
0
20
rpx
;
}
.input-wrapper_image
{
width
:
22px
;
height
:
22px
;
align-self
:
center
;
margin-right
:
10
rpx
;
}
</
style
>
pages/component/button/button.uvue
浏览文件 @
3944651f
...
...
@@ -37,18 +37,18 @@
</script>
<template>
<view class="main">
<button :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:style="default_style ? style : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
{{ text }}
</button>
</view>
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<!-- #endif -->
<view class="main">
<button :disabled="disabled_boolean" :size="size_enum[size_enum_current].name"
:type="type_enum[type_enum_current].name" :plain="plain_boolean" @click="button_click"
@touchstart="button_touchstart" @touchmove="button_touchmove" @touchcancel="button_touchcancel"
@touchend="button_touchend" @tap="button_tap" @longpress="button_longpress" class="btn"
:style="default_style ? style : ''" :hover-class="default_style ? 'is-hover' : 'button-hover'">
{{ text }}
</button>
</view>
<view class="content">
<boolean-data :defaultValue="false" title="按钮是否镂空,背景色透明" @change="change_plain_boolean"></boolean-data>
<boolean-data :defaultValue="false" title="是否禁用" @change="change_disabled_boolean"></boolean-data>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录