html中搜索框内默认自,方法默认初始值

ce098e3a70fb

image.png

1.点击搜索按钮的时候如果返回的数据为空,则提示弹框

2.搜索按钮与导航切换用的是同一方法

3.bug是点击导航切换如果没有数据的话也显示弹框

4.解决办法为:在html里给导航切换的方法一个默认值

5.在方法里如果有那个默认值,就清空数据

html

@select="handleSelect($event,1)" active-text-color="#3ca0ff">

待审核({{numObject.audit}})

审核通过({{numObject. passed}})

未审核通过({{numObject.fail}})

草稿箱({{numObject.draft}})

js

// 获取需求列表接口

handleSelect(key = null,s = null){

if(key) {

this.navname = +key

}

if(s===1) {

this.searchName = ''

}

if(this.navname === 2){

this.currentPage = this.totalCounts2.page

}else if(this.navname === 1){

this.currentPage = this.totalCounts1.page

}else if(this.navname === 3){

this.currentPage = this.totalCounts3.page

}else if(this.navname === 0){

this.currentPage = this.totalCounts0.page

}

let paramObj = {

"status":this.navname,

"page":this.currentPage,

"pageSize":this.pagesize,

"timestamp": new Date().getTime(),

}

// 是否有搜索内容

if(this.searchName !== '') {

paramObj.keywords = this.searchName

}

this.$api.post(

'/IPOSys/api/demand/getDemandList',

{

"content":this.getSign(paramObj)

},

res=>{

console.log(res)

console.log('获取需求列表接口')

if(this.searchName !== '' && res.demandList.length === 0){

this.$message('暂无搜索内容')

}

this.tableData = res.demandList

this.getNum()

if(this.navname === 2){

this.totalCounts2.pageTotal = res.pageUtil.pageTotal

this.numObject.audit = res.PageUtil.pageTotal

}else if(this.navname === 1){

this.totalCounts1.pageTotal = res.pageUtil.pageTotal

this.numObject.passed = res.PageUtil.pageTotal

}else if(this.navname === 3){

this.totalCounts3.pageTotal = res.pageUtil.pageTotal

this.numObject.fail = res.PageUtil.pageTotal

}else if(this.navname === 0){

this.totalCounts0.pageTotal = res.pageUtil.pageTotal

this.numObject.draft = res.PageUtil.pageTotal

}

}

)

},

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以使用以下HTML和CSS代码来创建一个圆角数字输入框,其包括初始值,等差加减操作和文本说明: HTML代码: ```html <div class="input-container"> <label for="number-input">Number Input:</label> <div class="input-group"> <button class="minus-button">-</button> <input type="number" id="number-input" value="0" /> <button class="plus-button">+</button> </div> </div> ``` CSS代码: ```css .input-container { display: flex; flex-direction: column; align-items: center; font-family: Arial, sans-serif; margin: 20px; } .label { font-size: 16px; font-weight: bold; margin-bottom: 10px; } .input-group { display: flex; border: 1px solid #ccc; border-radius: 5px; padding: 5px; } .minus-button, .plus-button { background-color: #eee; border: none; font-size: 18px; width: 30px; height: 30px; cursor: pointer; } .minus-button:hover, .plus-button:hover { background-color: #ddd; } #number-input { border: none; outline: none; font-size: 18px; width: 50px; text-align: center; } #number-input::-webkit-inner-spin-button, #number-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; } #number-input[type="number"] { -moz-appearance: textfield; } #number-input:focus { box-shadow: 0 0 0 1px #007bff; } .plus-button { border-radius: 0 5px 5px 0; } .minus-button { border-radius: 5px 0 0 5px; } ``` 解释: 1. HTML代码,我们首先创建一个包含标签和数字输入框的容器div。标签用来说明数字输入框的作用,数字输入框使用input元素创建,初始值设置为0。 2. 在数字输入框周围,我们使用另一个div元素创建一个输入框组,包括两个按钮(加和减)和数字输入框。减号按钮和数字输入框之间没有空格,加号按钮和数字输入框之间也没有空格。 3. CSS代码,我们首先定义了整个输入容器的样式,包括flex布局,字体,边距等。 4. 我们使用label元素定义标签的样式,包括字体大小,粗细和下边距。 5. 我们使用flex布局定义输入组的样式,包括边框,边框半径,填充和按钮的样式。 6. 我们使用CSS伪元素定义了数字输入框的样式,包括去掉内外旋转按钮,去掉箭头,去掉默认样式,设置输入框聚焦时的边框阴影。 7. 最后,我们设置了加号和减号按钮的边框半径,让它们分别在左右两端有圆角。 现在,你的圆角数字输入框就已经创建好了,可以运行代码看看效果。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值