You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
2.7 KiB
161 lines
2.7 KiB
|
|
Component({
|
|
options: {
|
|
addGlobalClass: true,
|
|
multipleSlots: true
|
|
},
|
|
/**
|
|
* 组件的属性列表
|
|
*/
|
|
properties: {
|
|
// 整个背景颜色
|
|
bgColor:{
|
|
type:String,
|
|
value:''
|
|
},
|
|
value:{
|
|
type:String,
|
|
value:''
|
|
},
|
|
// 输入框样式
|
|
inputStyle:{
|
|
type:String,
|
|
value:'0'
|
|
},
|
|
color:{
|
|
type:String,
|
|
value:''
|
|
},
|
|
// 输入框背景颜色
|
|
inputBg:{
|
|
type:String,
|
|
value:''
|
|
},
|
|
// 输入框圆角
|
|
radius:{
|
|
type:String,
|
|
value:'8000rpx'
|
|
},
|
|
password:{
|
|
type:Boolean,
|
|
value:false
|
|
},
|
|
// text、number、idcard、digit
|
|
type:{
|
|
type:String,
|
|
value:'text'
|
|
},
|
|
// 头部icon
|
|
prefixIcon:{
|
|
type:String,
|
|
value:'search'
|
|
},
|
|
// 尾部icon
|
|
suffixIcon:{
|
|
type:String,
|
|
value:''
|
|
},
|
|
// 输入框定位
|
|
position:{
|
|
type:String,
|
|
value:''
|
|
},
|
|
// 键盘右下角文本
|
|
// send、search、next、go、done
|
|
confirmType:{
|
|
type:String,
|
|
value:'done'
|
|
},
|
|
// 提示词
|
|
placeholder:{
|
|
type:String,
|
|
value:'请输入内容'
|
|
},
|
|
// 是否显示关闭按钮
|
|
close:{
|
|
type:Boolean,
|
|
value:false
|
|
},
|
|
// 是否禁用
|
|
disabled:{
|
|
type:Boolean,
|
|
value:false
|
|
},
|
|
// 额外按钮
|
|
extreaWord:{
|
|
type:String,
|
|
value:''
|
|
},
|
|
// 额外按钮颜色
|
|
extreaColor:{
|
|
type:String,
|
|
value:'#0081ff'
|
|
}
|
|
},
|
|
|
|
/**
|
|
* 组件的初始数据
|
|
*/
|
|
data: {
|
|
|
|
},
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
// 输入变化
|
|
getInput(e){
|
|
this.data.value = e.detail.value
|
|
this.setData({
|
|
value:e.detail.value
|
|
})
|
|
this.triggerEvent("input", { value: e.detail.value })
|
|
},
|
|
// 聚焦输入框变化
|
|
getFocus(e){
|
|
this.data.value = e.detail.value
|
|
this.setData({
|
|
value:e.detail.value
|
|
})
|
|
this.triggerEvent("focus", {
|
|
value: e.detail.value
|
|
})
|
|
},
|
|
// 失焦
|
|
getBlur(e){
|
|
this.data.value = e.detail.value
|
|
this.setData({
|
|
value:e.detail.value
|
|
})
|
|
this.triggerEvent("blur", {
|
|
value: e.detail.value
|
|
},{})
|
|
},
|
|
// 聚焦输入框变化
|
|
getConfirm(e){
|
|
this.data.value = e.detail.value
|
|
this.setData({
|
|
value:e.detail.value
|
|
})
|
|
this.triggerEvent("confirm", {
|
|
value: e.detail.value
|
|
})
|
|
},
|
|
// 额外按钮
|
|
extreaBtn(){
|
|
this.triggerEvent("extrea", {
|
|
value: this.data.value
|
|
},{})
|
|
},
|
|
// 关闭
|
|
close(){
|
|
this.setData({
|
|
value:''
|
|
})
|
|
this.triggerEvent("close", {
|
|
value: ''
|
|
})
|
|
}
|
|
}
|
|
})
|