当前位置: 首页 > wzjs >正文

网站安全怎么做国内seo公司哪家最好

网站安全怎么做,国内seo公司哪家最好,8图片这样的网站怎么做的,重庆电商网站建设组件介绍 这是一个用于获取验证码的倒计时按钮组件&#xff0c;支持自定义倒计时时间、按钮样式和文字格式。 基本用法 <countdown-verify seconds"60"button-text"获取验证码"bind:send"onSendVerifyCode" />属性说明 属性名类型默认…

组件介绍

这是一个用于获取验证码的倒计时按钮组件,支持自定义倒计时时间、按钮样式和文字格式。

基本用法

<countdown-verify seconds="60"button-text="获取验证码"bind:send="onSendVerifyCode"
/>

属性说明

属性名类型默认值说明
secondsNumber60倒计时总时长(秒),必须大于0
buttonTextString“获取验证码”按钮默认显示的文字
countdownFormatString“剩余%s秒”倒计时过程中显示的文字格式,%s会被替换为剩余秒数
buttonStyleString“”按钮的样式,支持内联样式
disabledStyleString“background-color: #cccccc; color: #ffffff;”倒计时过程中按钮的样式
instanceIdString“”组件实例ID,用于多实例区分,不传会自动生成

事件说明

事件名说明参数
send点击获取验证码按钮时触发{ instanceId: string }
start倒计时开始时触发{ instanceId: string }
end倒计时结束时触发{ instanceId: string }

方法说明

方法名说明参数返回值
start()开始倒计时
stop()停止倒计时
reset()重置倒计时
getStatus()获取当前状态{ isCounting: boolean, remaining: number, instanceId: string }

使用示例

Page({data: {// ...},onSendVerifyCode(e) {// 发送验证码请求wx.request({url: 'your-api-url',success: () => {// 请求成功后开始倒计时this.selectComponent('#verifyCode').start();}});}
});

注意事项

组件会自动处理倒计时过程中的状态切换
倒计时过程中按钮会被禁用
组件销毁时会自动清理定时器
支持多个实例同时使用,每个实例都有唯一的instanceId
倒计时时间必须大于0,否则会自动设置为60秒

样式定制

可以通过 buttonStyle 和 disabledStyle 属性来自定义按钮样式,支持所有CSS属性。

<countdown-verify button-style="background-color: #007AFF; color: white; border-radius: 4px;"disabled-style="background-color: #999999; color: white;"
/>

完整代码

js

// components/countdown-verify/countdown-verify.js
Component({properties: {// 倒计时总时长(秒)seconds: {type: Number,value: 60,observer: function (newVal) {if (newVal <= 0) {console.warn("倒计时时间必须大于0");this.setData({ seconds: 60 });}},},// 按钮默认文字buttonText: {type: String,value: "获取验证码",},// 禁用状态下的文字格式countdownFormat: {type: String,value: "剩余%s秒",},// 按钮样式buttonStyle: {type: String,value: "",},// 禁用状态按钮样式disabledStyle: {type: String,value: "background-color: #cccccc; color: #ffffff;",},// 实例ID,用于多实例区分instanceId: {type: String,value: "",},},data: {remaining: 0,isCounting: false,timer: null,displayText: "",},lifetimes: {attached() {// 生成唯一实例IDif (!this.properties.instanceId) {this.setData({instanceId:"countdown_" +Date.now() +"_" +Math.random().toString(36).substr(2),});}this.updateDisplayText();},detached() {this.clearTimer();},},// 监听倒计时和是否正在倒计时,更新显示文本observers: {"remaining, isCounting": function (remaining, isCounting) {this.updateDisplayText();},},methods: {// 更新显示文本updateDisplayText() {const text = this.data.isCounting? this.properties.countdownFormat.replace("%s", this.data.remaining): this.properties.buttonText;this.setData({ displayText: text });},// 开始倒计时start() {if (this.data.isCounting) {console.warn("倒计时正在进行中");return;}this.clearTimer();this.setData({isCounting: true,remaining: this.properties.seconds,});this.data.timer = setInterval(() => {const remaining = this.data.remaining - 1;if (remaining <= 0) {this.stop();return;}this.setData({ remaining });}, 1000);this.triggerEvent("start", { instanceId: this.data.instanceId });},// 停止倒计时stop() {this.clearTimer();this.setData({isCounting: false,remaining: 0,});this.triggerEvent("end", { instanceId: this.data.instanceId });},// 清除定时器clearTimer() {if (this.data.timer) {clearInterval(this.data.timer);this.data.timer = null;}},// 按钮点击事件handleTap() {if (!this.data.isCounting) {this.triggerEvent("send", { instanceId: this.data.instanceId });}},// 重置倒计时reset() {this.stop();},// 获取当前状态getStatus() {return {isCounting: this.data.isCounting,remaining: this.data.remaining,instanceId: this.data.instanceId,};},},
});

wxml

<!-- components/countdown-verify/countdown-verify.wxml -->
<button style="{{isCounting ? disabledStyle : buttonStyle}}" disabled="{{isCounting}}" bind:tap="handleTap" aria-label="{{isCounting ? '倒计时中' : buttonText}}" data-instance-id="{{instanceId}}">{{displayText}}
</button>

wxss

/* components/countdown-verify/countdown-verify.wxss */
button {margin: 0;padding: 0;border: none;background: none;font-size: 28rpx;line-height: 1.5;text-align: center;border-radius: 8rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;min-width: 180rpx;height: 80rpx;display: flex;align-items: center;justify-content: center;
}button[disabled] {opacity: 0.6;
}
button::after {border: none;
}

json

{"component": true,"usingComponents": {}
}
http://www.dtcms.com/wzjs/3299.html

相关文章:

  • 网站设计公司南京看广告收益最高的软件
  • 电子商务网站建设答辩记录广州网络优化最早的公司
  • 建材企业网站推广自己建个网站要多少钱
  • 网站seo诊断优化分析该怎么做谷歌google官网入口
  • 买网站服务器网络推广seo怎么弄
  • 最好看的政府网站手机上怎么制作网页
  • 网套加工机器设备徐州seo代理计费
  • 如何做收费影视资源网站南昌seo全网营销
  • thinkphp3.2 企业网站源码杭州seook优屏网络
  • 个人网站要买多大的空间广州线下教学
  • 微信网站建设模板广告推广费用一般多少
  • 上海做网站费用新疆今日头条新闻
  • 酒店网站方案郑州靠谱seo整站优化
  • win10电脑做网站百度地图排名可以优化吗
  • 网站建设的要求有哪些系统优化软件哪个最好的
  • 设计班级网站建设百度优化怎么做
  • 做设计网站网络推广员每天的工作是什么
  • 哪个网站可以做服装批发衣服宁波网络营销有哪些
  • 个人建网站成本网上推广怎么做
  • 西安市阎良区建设局网站百度竞价广告怎么投放
  • 网站添加新闻栏怎么做长沙网站提升排名
  • 杨凌做网站的公司网站推广的常用方法有哪些?
  • 番禺网站建设效果拓客平台有哪些
  • 网页设计简介seo优化策略
  • 网站做3儿童车开场动画杭州上城区抖音seo如何
  • 深圳营销型网站建设电话公司网站设计哪家好
  • 视频网站用什么cms电商平台链接怎么弄
  • 耒阳网站建设怎么在百度上做推广
  • php购物网站设计代码网站统计数据分析
  • 银川市住房城乡建设局网站武汉网站设计