123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <template>
- <view class="zs-search" :class="[fixed?'fixed':'']">
- <input class="input" :style="{lineHeight:height+'rpx',height:height+'rpx',borderRadius:height / 2+'px',color:color,background:bgColor}" :type="type" v-model="value" :placeholder="placeholder" />
- <image class="icon" src="../../static/search.png" mode=""></image>
- <button class="btn" type="default" @click="search">搜索</button>
- </view>
- </template>
- <script>
- export default {
- props: {
- type: {
- type: String,
- default: 'text'
- },
- height: {
- type: String,
- default: '72'
- },
- color: {
- type: String,
- default: '#606266'
- },
- bgColor:{
- type: String,
- default: '#efefef'
- },
- fixed:{
- type: Boolean,
- default: false
- },
- value:{
- },
- placeholder:{
- type: String,
- default: '搜索'
- }
- },
- data() {
- return {
- value1:this.value
- }
- },
- onReady(res) {
- },
- onLoad(){
- },
-
- methods: {
- input(val){
- this.$emit('input',this.value1 )
- },
- search(){
- this.$emit('search',this.value1)
- }
- }
- }
- </script>
- <style lang="scss">
- .zs-search{
- box-sizing: border-box;
- top: 0%;
- left: 0;
- position: relative;
- margin: 0 30rpx;
- .input{
- box-sizing: border-box;
- padding-left: 100rpx;
- padding-right: 130rpx;
- }
- .icon {
- width: 37rpx;
- height: 37rpx;
- position: absolute;
- top: 50%;
- left: 36rpx;
- transform: translateY(-50%);
- }
-
- .btn {
- position: absolute;
- top: 50%;
- transform: translateY(-50%);
- right: 10rpx;
- width: 128rpx;
- height: 56rpx;
- line-height: 56rpx;
- background: #FF4C3A;
- color: #fff;
- font-size: 28rpx;
- border-radius: 32rpx;
- padding: 0;
- }
- }
- .fixed{
- position: fixed !important;
- }
- </style>
|