提交 9ce8e5fa 编写于 作者: 雪洛's avatar 雪洛

fix: 调整部分写法兼容web端

上级 ba960883
export type ItemType = { value : number; name : string }
\ No newline at end of file
<script lang="uts"> <script lang="uts">
import {type PropType} from 'vue' import { PropType } from 'vue'
import { ItemType } from './enum-data'
export type ItemType = { value : number; name : string }
export default { export default {
emits: ['change'], emits: ['change'],
...@@ -24,9 +23,9 @@ ...@@ -24,9 +23,9 @@
// @ts-ignore // @ts-ignore
_change(e : RadioGroupChangeEvent) { _change(e : RadioGroupChangeEvent) {
const selected = this.items.find((item: ItemType) : boolean => { const selected = this.items.find((item: ItemType) : boolean => {
return item.name === e.detail.value return item.name == e.detail.value
}) })
if (selected !== null) { if (selected != null) {
this.current = selected.value this.current = selected.value
this.$emit('change', this.current) this.$emit('change', this.current)
uni.showToast({ uni.showToast({
......
<script> <script>
import { type ItemType } from '@/components/enum-data/enum-data.vue' import { ItemType } from '@/components/enum-data/enum-data'
export default { export default {
data() { data() {
return { return {
......
<script> <script>
import { type ItemType } from '@/components/enum-data/enum-data.vue' import { ItemType } from '@/components/enum-data/enum-data'
export default { export default {
data() { data() {
return { return {
......
<script> <script>
import { type ItemType } from '@/components/enum-data/enum-data.vue' import { ItemType } from '@/components/enum-data/enum-data'
export default { export default {
data() { data() {
return { return {
......
<script> <script>
import { type ItemType } from '@/components/enum-data/enum-data.vue' import { ItemType } from '@/components/enum-data/enum-data'
export default { export default {
data() { data() {
return { return {
......
<template> <template>
<page-head title="view"></page-head> <page-head title="view"></page-head>
<view class="main" :hover-class="hover_class ? 'is-parent-hover' : 'none'"> <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 class="test-view" :hover-class="hover_class ? 'is-hover' : 'none'" :hover-stop-propagation="stop_propagation"
</view> :hover-start-time="start_time" :hover-stay-time="stay_time">
</view> </view>
<!-- #ifdef APP --> </view>
<scroll-view style="flex: 1"> <!-- #ifdef APP -->
<!-- #endif --> <scroll-view style="flex: 1">
<view class="content"> <!-- #endif -->
<boolean-data :defaultValue="false" title="是否指定按下去的样式类" @change="change_hover_class_boolean"></boolean-data> <view class="content">
<boolean-data :defaultValue="false" title="是否阻止本节点的祖先节点出现点击态" @change="change_stop_propagation_boolean"></boolean-data> <boolean-data :defaultValue="false" title="是否指定按下去的样式类" @change="change_hover_class_boolean"></boolean-data>
<enum-data :items="start_time_enum" title="按住后多久出现点击态" @change="radio_change_start_time_enum"></enum-data> <boolean-data :defaultValue="false" title="是否阻止本节点的祖先节点出现点击态"
<enum-data :items="stay_time_enum" title="手指松开后点击态保留时间" @change="radio_change_stay_time_enum"></enum-data> @change="change_stop_propagation_boolean"></boolean-data>
</view> <enum-data :items="start_time_enum" title="按住后多久出现点击态" @change="radio_change_start_time_enum"></enum-data>
<!-- #ifdef APP --> <enum-data :items="stay_time_enum" title="手指松开后点击态保留时间" @change="radio_change_stay_time_enum"></enum-data>
</scroll-view> </view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif --> <!-- #endif -->
</template> </template>
<script> <script>
import { type ItemType } from '@/components/enum-data/enum-data.vue' import { ItemType } from '@/components/enum-data/enum-data.vue'
export default { export default {
data() { data() {
return { return {
hover_class: false, hover_class: false,
stop_propagation: false, stop_propagation: false,
start_time: 50, start_time: 50,
stay_time: 400, stay_time: 400,
start_time_enum: [{ "value": 50, "name": "50毫秒" }, { "value": 200, "name": "200毫秒" }] as ItemType[], 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[] stay_time_enum: [{ "value": 400, "name": "400毫秒" }, { "value": 200, "name": "200毫秒" }] as ItemType[]
} }
}, },
methods: { methods: {
change_hover_class_boolean(checked : boolean) { change_hover_class_boolean(checked : boolean) {
this.hover_class = checked this.hover_class = checked
}, },
change_stop_propagation_boolean(checked : boolean) { change_stop_propagation_boolean(checked : boolean) {
this.stop_propagation = checked this.stop_propagation = checked
}, },
radio_change_start_time_enum(time : number) { radio_change_start_time_enum(time : number) {
this.start_time = time this.start_time = time
}, },
radio_change_stay_time_enum(time : number) { radio_change_stay_time_enum(time : number) {
this.stay_time = time this.stay_time = time
},
}, },
}, }
}
</script> </script>
<style> <style>
.main { .main {
padding: 10rpx 0; padding: 10rpx 0;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
} }
.test-view {
height: 200px; .test-view {
width: 200px; height: 200px;
background-color: white; width: 200px;
} background-color: white;
.text { }
color: #777;
font-size: 26rpx; .text {
} color: #777;
.is-hover { font-size: 26rpx;
}
.is-hover {
background-color: #179b16; background-color: #179b16;
} }
.is-parent-hover { .is-parent-hover {
background-color: #aa0000; background-color: #aa0000;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册