liuleilei
2024-10-28 00e3512ca69976b5b9f3c30c1995bfb9c3751f72
h5/components/search.vue
@@ -21,7 +21,11 @@
         </view>
         <view class="search_box_item_xl" v-if="searchData && searchData.length > 0">
            <view class="search_box_item_xl_item" v-for="(item, i) in searchData" :key="i">
               <view :class="index === i ? 'search_box_item_xl_item_name active' : 'search_box_item_xl_item_name'" @click="clickItem(item, i)">{{ item.name }}</view><span v-if="item.price">¥{{ item.price }}</span>
               <view :class="index === i ? 'search_box_item_xl_item_name active' : 'search_box_item_xl_item_name'" @click="clickItem(item, i)" @mouseenter="aaa(i)" @mouseleave="bbb">
                  <span :style="{color: fontColorIndex === i ? fontColor : ''}">{{item.name}}</span>
               </view>
               <span v-if="item.price">¥{{ item.price }}</span>
            </view>
         </view>
         
@@ -62,7 +66,8 @@
            name2: '',
            
            index: 0,
            focus: true
            focus: true,
            fontColorIndex: ''
         }
      },
      props: {
@@ -85,6 +90,10 @@
         },
         categoryid: {
            type: Number | String
         },
         fontColor:{
            type: Number | String
         }
      },
      watch: {
@@ -101,6 +110,12 @@
         }
      },
      methods: {
         aaa(index) {
            this.fontColorIndex = index
         },
         bbb() {
            this.fontColorIndex = ''
         },
         percentage(bgColor, alpha) {
            let res = +(alpha * 2.55).toFixed(0)
            return bgColor + res.toString(16)