search

发布时间 2023-10-21 23:34:16作者: 樱花馆长

"search":"/components/search/search"
// components/search/search.js
Component({
  properties: {
    innerText:{
      type: String,
      value: '搜索',
    }
  },
  data: {
  },
  methods: {
    redirect(){
      wx.navigateTo({
        url: '/pages/chazhao/chazhao',
        success:(res)=>{
          console.log(res);
        },
        fail(res){
          console.log(res);
        }
      })
    }
  }
})
<view class="search" bind:tap="redirect">
    <navigator>
        <icon type="search" size="40rpx"></icon>
        <view class="inner">{{innerText}}</view>
    </navigator>
</view>
.search{
  height: 110rpx;
  background-color: red;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 999;
}
.search navigator{
  height: 90rpx;
  width: 95%;
  display: flex;
  background-color: #fff;
  justify-content: center;
  align-items: center;
  border-radius: 10rpx;
}