view.uvue 2.5 KB
Newer Older
Y
init  
yurj26 已提交
1
<template>
shutao-dc's avatar
shutao-dc 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
  <page-head title="view"></page-head>
  <view class="main" :hover-class="hover_class ? 'is-parent-hover' : 'none'">
    <view class="test-view" :hover-class="hover_class ? 'is-hover' : 'none'" :hover-stop-propagation="stop_propagation" :hover-start-time="start_time" :hover-stay-time="stay_time">
    </view>
  </view>
  <!-- #ifdef APP -->
  <scroll-view style="flex: 1">
    <!-- #endif -->
    <view class="content">
      <boolean-data :defaultValue="false" title="是否指定按下去的样式类" @change="change_hover_class_boolean"></boolean-data>
      <boolean-data :defaultValue="false" title="是否阻止本节点的祖先节点出现点击态" @change="change_stop_propagation_boolean"></boolean-data>
      <enum-data :items="start_time_enum" title="按住后多久出现点击态" @change="radio_change_start_time_enum"></enum-data>
      <enum-data :items="stay_time_enum" title="手指松开后点击态保留时间" @change="radio_change_stay_time_enum"></enum-data>
      <view class="uni-padding-wrap uni-common-mt uni-common-mb">
        <button class="uni-common-mt" @click="goGeneralAttribute('/pages/component/view/view-draw')">DrawableContext</button>
      </view>
    </view>
    <!-- #ifdef APP -->
  </scroll-view>
DCloud-WZF's avatar
DCloud-WZF 已提交
21
  <!-- #endif -->
Y
init  
yurj26 已提交
22
</template>
shutao-dc's avatar
shutao-dc 已提交
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
<script>
import { type ItemType } from '@/components/enum-data/enum-data.vue'
export default {
  data() {
    return {
      hover_class: false,
      stop_propagation: false,
      start_time: 50,
      stay_time: 400,
      start_time_enum: [{ "value": 50, "name": "50毫秒" }, { "value": 200, "name": "200毫秒" }] as ItemType[],
      stay_time_enum: [{ "value": 400, "name": "400毫秒" }, { "value": 200, "name": "200毫秒" }] as ItemType[]
    }
  },
  methods: {
    change_hover_class_boolean(checked : boolean) {
      this.hover_class = checked
    },
    change_stop_propagation_boolean(checked : boolean) {
      this.stop_propagation = checked
    },
    radio_change_start_time_enum(time : number) {
      this.start_time = time
    },
    radio_change_stay_time_enum(time : number) {
      this.stay_time = time
    },
49
    goGeneralAttribute(path: string) {
50
      uni.navigateTo({
51
        url: path,
52
      })
53 54
    },
  },
DCloud-WZF's avatar
DCloud-WZF 已提交
55
}
Y
init  
yurj26 已提交
56 57 58
</script>

<style>
shutao-dc's avatar
shutao-dc 已提交
59 60 61 62
.main {
    padding: 10rpx 0;
    flex-direction: row;
    justify-content: center;
DCloud-WZF's avatar
DCloud-WZF 已提交
63
}
shutao-dc's avatar
shutao-dc 已提交
64 65 66 67
.test-view {
  height: 200px;
  width: 200px;
  background-color: white;
DCloud-WZF's avatar
DCloud-WZF 已提交
68 69 70 71
}
.text {
  color: #777;
  font-size: 26rpx;
shutao-dc's avatar
shutao-dc 已提交
72 73 74 75 76 77 78
}
.is-hover {
    background-color: #179b16;
}

.is-parent-hover {
    background-color: #aa0000;
DCloud-WZF's avatar
DCloud-WZF 已提交
79 80
}
</style>