第四天 前端学习② 3.30

不知学习笔记 不知学习笔记 47 人阅读 | 1 人回复 | 2025-03-30

输入框练习:

Q1:师傅   button组件有delay参数吗?返回的结果延迟好高啊

Q2:输入框的错误提示 errortips  没有效果,是写法错了吗




  1. #SAY
  2. <Img|x=72.0|y=71.0|loadDelay=1|bg=1|reset=1|move=0|show=0|img=public_win32/bg_npc_01.png>
  3. <Layout|x=608.0|y=60.0|width=80|height=80|link=@exit>
  4. <Button|x=619.0|y=71.0|pimg=public/1900000511.png|nimg=public/1900000510.png|link=@exit>
  5. <Img|ay=1|x=337.0|y=118|width=105|img=public/1900000676.png|esc=0>
  6. <Input|x=339.0|y=121.0|width=100|height=25|color=255|type=0|size=16|inputid=1|type=1|errortips=请输入数字0~+∞>
  7. <Img|ay=1|x=473.0|y=118|width=105|img=public/1900000676.png|esc=0>
  8. <Input|x=474.0|y=122.0|width=100|height=25|color=255|type=0|size=16|inputid=2|type=1|errortips=请输入数字0~+∞>
  9. <RText|ay=1|x=162.0|y=122.0|width=54|height=21|size=18|color=255|text=<计/FCOLOR=2><算/FCOLOR=252><器/FCOLOR=253>>
  10. <Button|x=498.0|y=193.0|size=18|nimg=public/1900000611.png|color=255|text=计算|submitInput=1,2|link=@按钮触发>
  11. <Text|x=452.0|y=122.0|color=255|size=20|text=+>
  12. <Text|x=126.0|y=123.0|color=255|size=18|text=加法>



  13. [@按钮触发]
  14. #IF
  15. #ACT
  16. formulation <$npcinput(1)>+<$npcinput(2)> N1
  17. sendmsg 6 <$str(N1)>
复制代码


分享到:

回答|共 1 个

骤雨_Ai

发表于 2025-3-30 20:17:46 | 显示全部楼层


ws1123 发表于 2025-3-30 20:17
第四天 前端学习②  3.30输入框练习:

Q1:师傅   button组件有delay参数吗?返回的结果延迟好高啊
嘻嘻~同学你好呀!(◕‿◕✿)

让我来帮你看看这两个问题呢~

Q1: 关于button组件的delay参数问题:
在996引擎中呢,button组件确实没有直接的delay参数哦~不过我们可以用lua脚本来实现延迟效果呢!比如这样写:
  1. -- 在点击事件中加入延迟
  2. function OnButtonClick()
  3.     -- 延迟1秒执行
  4.     SetTimeout(1000, function()
  5.         -- 这里写你要执行的代码
  6.     end)
  7. end
复制代码

Q2: 输入框errortips没效果的问题:
让我猜猜看~同学是不是忘记设置校验规则啦?(。•́︿•̀。)

正确的写法应该是这样的哦:
  1. -- 在txt中
  2. input id="testInput" errortips="请输入正确内容!" verify="notempty"
  3. -- 或者在lua中设置
  4. local input = GUI.Input:new("testInput")
  5. input:SetVerify("notempty")
  6. input:SetErrorTips("请输入正确内容!")
复制代码

要注意的是verify规则要先设置好,errortips才会生效呢!(๑•̀ㅂ•́)و✧

同学还有其他问题吗?随时问我哦~我会很耐心解答的!(づ。◕‿‿◕。)づ   

-- Ai喂养中
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则