Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
3944651f
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6005
Star
91
Fork
164
代码
文件
提交
分支
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"
>
<
script
lang=
"uts"
>
export
default
{
export
default
{
name
:
"
input-data
"
,
name
:
"
input-data
"
,
props
:
{
props
:
{
title
:
{
title
:
{
type
:
String
,
type
:
String
,
required
:
true
required
:
true
},
},
type
:
{
type
:
{
type
:
String
,
type
:
String
,
required
:
true
required
:
true
},
},
defaultValue
:
{
defaultValue
:
{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
default
:
''
default
:
''
}
}
},
},
data
()
{
data
()
{
return
{
return
{
inputClearValue
:
''
as
any
,
inputClearValue
:
''
as
any
,
showClearIcon
:
false
,
showClearIcon
:
false
,
inputType
:
'
text
'
inputType
:
'
text
'
}
}
},
},
created
()
{
created
()
{
switch
(
this
.
type
)
{
switch
(
this
.
type
)
{
case
'
number
'
:
case
'
number
'
:
this
.
inputType
=
'
number
'
this
.
inputType
=
'
number
'
break
;
break
;
}
}
this
.
inputClearValue
=
this
.
getValue
(
this
.
defaultValue
)
this
.
inputClearValue
=
this
.
getValue
(
this
.
defaultValue
)
},
},
methods
:
{
methods
:
{
input
:
function
(
event
:
InputEvent
)
{
input
:
function
(
event
:
InputEvent
)
{
// @ts-ignore
// @ts-ignore
this
.
inputClearValue
=
event
.
detail
.
value
this
.
inputClearValue
=
event
.
detail
.
value
if
((
this
.
inputClearValue
as
string
).
length
>
0
)
{
if
((
this
.
inputClearValue
as
string
).
length
>
0
)
{
this
.
showClearIcon
=
true
this
.
showClearIcon
=
true
}
else
{
}
else
{
this
.
showClearIcon
=
false
this
.
showClearIcon
=
false
}
}
this
.
$emit
(
'
confirm
'
,
this
.
getValue
(
this
.
inputClearValue
))
this
.
$emit
(
'
confirm
'
,
this
.
getValue
(
this
.
inputClearValue
))
},
},
clearIcon
:
function
()
{
clearIcon
:
function
()
{
this
.
inputClearValue
=
''
this
.
inputClearValue
=
''
this
.
showClearIcon
=
false
this
.
showClearIcon
=
false
},
this
.
$emit
(
'
confirm
'
,
this
.
getValue
(
this
.
inputClearValue
))
// @ts-ignore
},
confirm
(
e
:
InputConfirmEvent
)
{
// @ts-ignore
// this.$emit('confirm', this.getValue(e.detail.value))
confirm
(
e
:
InputConfirmEvent
)
{
},
// this.$emit('confirm', this.getValue(e.detail.value))
blur
()
{
},
this
.
showClearIcon
=
false
blur
()
{
},
this
.
showClearIcon
=
false
focus
()
{
},
let
inputValue
=
this
.
inputClearValue
focus
()
{
if
(
typeof
inputValue
!==
'
string
'
)
{
let
inputValue
=
this
.
inputClearValue
inputValue
=
inputValue
.
toString
()
if
(
typeof
inputValue
!==
'
string
'
)
{
}
inputValue
=
inputValue
.
toString
()
if
((
inputValue
as
string
).
length
>
0
)
{
}
this
.
showClearIcon
=
true
if
((
inputValue
as
string
).
length
>
0
)
{
}
else
{
this
.
showClearIcon
=
true
this
.
showClearIcon
=
false
}
else
{
}
this
.
showClearIcon
=
false
},
}
getValue
(
value
:
any
)
:
any
{
},
switch
(
this
.
type
)
{
getValue
(
value
:
any
)
:
any
{
case
'
number
'
:
switch
(
this
.
type
)
{
return
parseFloat
(
value
as
string
)
case
'
number
'
:
}
return
parseFloat
(
value
as
string
)
}
return
value
return
value
}
}
}
}
}
}
</
script
>
</
script
>
<
template
>
<
template
>
<view
class=
"uni-padding-wrap"
>
<view
class=
"uni-padding-wrap"
>
<view
class=
"uni-title uni-common-mt"
>
<view
class=
"uni-title uni-common-mt"
>
<text
class=
"uni-title-text"
>
{{
title
}}
</text>
<text
class=
"uni-title-text"
>
{{
title
}}
</text>
</view>
</view>
</view>
</view>
<view
class=
"uni-input-wrapper input-wrapper"
>
<view
class=
"uni-input-wrapper input-wrapper"
>
<input
class=
"uni-input"
:type=
"inputType"
:value=
"inputClearValue"
:placeholder=
"title"
@
input=
"input"
<input
class=
"uni-input"
:type=
"inputType"
:value=
"inputClearValue"
:placeholder=
"title"
@
input=
"input"
@
confirm=
"confirm"
@
blur=
"blur"
@
focus=
"focus"
/>
@
confirm=
"confirm"
@
blur=
"blur"
@
focus=
"focus"
/>
<image
class=
"input-wrapper_image"
src=
"/static/icons/clear.png"
v-if=
"showClearIcon"
@
click=
"clearIcon"
>
<image
class=
"input-wrapper_image"
src=
"/static/icons/clear.png"
v-if=
"showClearIcon"
@
click=
"clearIcon"
>
</image>
</image>
</view>
</view>
</
template
>
</
template
>
<
style
>
<
style
>
.
input-wrapper
{
.uni-
input-wrapper
{
border
:
1px
solid
rgba
(
0
,
0
,
0
,
.08
)
;
padding
:
8px
13px
;
justify-content
:
center
;
margin
:
10
rpx
0
;
padding
:
0
;
flex-direction
:
row
;
margin
:
0
20
rpx
;
flex-wrap
:
nowrap
;
background-color
:
#FFF
;
background-color
:
#ffffff
;
}
}
.input-wrapper_image
{
.input-wrapper
{
width
:
22px
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
.08
);
height
:
22px
;
flex-direction
:
row
;
align-self
:
center
;
justify-content
:
center
;
margin-right
:
10
rpx
;
padding
:
0
;
}
margin
:
0
20
rpx
;
}
.input-wrapper_image
{
width
:
22px
;
height
:
22px
;
align-self
:
center
;
margin-right
:
10
rpx
;
}
</
style
>
</
style
>
pages/component/button/button.uvue
浏览文件 @
3944651f
...
@@ -37,18 +37,18 @@
...
@@ -37,18 +37,18 @@
</script>
</script>
<template>
<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 -->
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<scroll-view style="flex: 1">
<!-- #endif -->
<!-- #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">
<view class="content">
<boolean-data :defaultValue="false" title="按钮是否镂空,背景色透明" @change="change_plain_boolean"></boolean-data>
<boolean-data :defaultValue="false" title="按钮是否镂空,背景色透明" @change="change_plain_boolean"></boolean-data>
<boolean-data :defaultValue="false" title="是否禁用" @change="change_disabled_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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录