button.uvue 1.6 KB
Newer Older
D
DCloud_LXH 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<script>
import { type ItemType } from '@/components/enum-data/enum-data.vue'
export default {
	data() {
		return {
      plain_boolean: false,
      disabled_boolean: false,
      size_enum: [{"value":0,"name":"default"},{"value":1,"name":"mini"}] as ItemType[],
      size_enum_current: 0,
      type_enum: [{"value":0,"name":"default"},{"value":1,"name":"primary"},{"value":2,"name":"warn"}] as ItemType[],
      type_enum_current: 0
		}
	},
	methods: {
    change_plain_boolean(checked : boolean) { this.plain_boolean = checked },
    change_disabled_boolean(checked : boolean) { this.disabled_boolean = checked },
    radio_change_size_enum(checked : number) { this.size_enum_current = checked },
    radio_change_type_enum(checked : number) { this.type_enum_current = checked }
	}
}
</script>

Y
init  
yurj26 已提交
23
<template>
D
DCloud_LXH 已提交
24
	<view class="uni-flex-row">
D
DCloud_LXH 已提交
25
<button :disabled="disabled_boolean" :size="size_enum[size_enum_current].name" :type="type_enum[type_enum_current].name" :plain="plain_boolean">uni-app-x</button>
D
DCloud_LXH 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
	</view>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<view class="content nvue">

    <boolean-data :defaultValue="false" title="按钮是否镂空,背景色透明" @change="change_plain_boolean"></boolean-data>

    <boolean-data :defaultValue="false" title="是否禁用" @change="change_disabled_boolean"></boolean-data>

    <enum-data :items="size_enum" title="按钮的大小" @change="radio_change_size_enum"></enum-data>

    <enum-data :items="type_enum" title="按钮的类型" @change="radio_change_type_enum"></enum-data>
</view>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>

<style>

</style>