import { IBestToast } from "basic"

@Component
export struct TextInputCom{
  @Prop text:string=""
  changeText=(text:string)=>{

  }
  build() {
    Stack({alignContent:Alignment.End}){
      TextInput({text:this.text})
        .fontColor($r('[basic].color.login_main_yellow'))
        .borderRadius(15).width('100%')
        .backgroundColor('#787878')
        .onChange((value)=>{
          if(value.length>7){
            IBestToast.show({
              message:'最多7个字'
            })
            this.text=value.slice(0,7)
            return
          }
          this.text=value
          this.changeText(this.text)

        })
      Image($r('app.media.muyu')).width(24).margin({right:10}).onClick(()=>{this.text=""})
    }
  }
}