浏览代码

Merge branch 'next' of https://github.com/jdf2e/nutui into next

richard1015 4 年之前
父节点
当前提交
d9f585a3d7

+ 3 - 0
src/packages/__VUE/elevator/index.scss

@@ -33,6 +33,9 @@
         padding: 0 20px;
         height: 30px;
         line-height: 30px;
+        &--highcolor {
+          color: $elevator-list-item-highcolor;
+        }
       }
     }
   }

+ 4 - 4
src/packages/__VUE/elevator/index.taro.vue

@@ -16,6 +16,7 @@
         <view class="nut-elevator__list__item__code">{{ item[acceptKey] }}</view>
         <view
           class="nut-elevator__list__item__name"
+          :class="{ 'nut-elevator__list__item__name--highcolor': currentData.id === subitem.id }"
           v-for="subitem in item.list"
           :key="subitem['id']"
           @click="handleClickItem(item[acceptKey], subitem)"
@@ -84,7 +85,8 @@ export default create({
       currentIndex: 0,
       query: Taro.createSelectorQuery(),
       scrollTop: 0,
-      storageListHeight: [] as number[]
+      storageListHeight: [] as number[],
+      currentData: {} as ElevatorData
     });
 
     const classes = computed(() => {
@@ -173,6 +175,7 @@ export default create({
 
     const handleClickItem = (key: string, item: ElevatorData) => {
       context.emit('click-item', key, item);
+      state.currentData = item;
     };
 
     const handleClickIndex = (key: string) => {
@@ -180,9 +183,6 @@ export default create({
     };
 
     onMounted(() => {
-      Taro.nextTick(() => {
-        calculateHeight();
-      });
       if (Taro.getEnv() === 'WEB') {
         calculateHeight();
       } else {

+ 4 - 1
src/packages/__VUE/elevator/index.vue

@@ -5,6 +5,7 @@
         <view class="nut-elevator__list__item__code">{{ item[acceptKey] }}</view>
         <view
           class="nut-elevator__list__item__name"
+          :class="{ 'nut-elevator__list__item__name--highcolor': currentData.id === subitem.id }"
           v-for="subitem in item.list"
           :key="subitem['id']"
           @click="handleClickItem(item[acceptKey], subitem)"
@@ -69,7 +70,8 @@ export default create({
         y2: 0
       },
       scrollStart: false,
-      currentIndex: 0
+      currentIndex: 0,
+      currentData: {} as ElevatorData
     });
 
     const classes = computed(() => {
@@ -152,6 +154,7 @@ export default create({
 
     const handleClickItem = (key: string, item: ElevatorData) => {
       context.emit('click-item', key, item);
+      state.currentData = item;
     };
 
     const handleClickIndex = (key: string) => {

+ 3 - 0
src/packages/styles/variables.scss

@@ -461,5 +461,8 @@ $subsidenavbar-title-bg-color: #f6f6f6 !default;
 // sidenavbaritem
 $sidenavbaritem-title-color: $white !default;
 
+// elevator
+$elevator-list-item-highcolor: $primary-color !default;
+
 @import './mixins/index';
 @import './animation/index';