Files
xdd-uniapp-new/components/CheckboxIcon.vue
T

59 lines
1.1 KiB
Vue

<template>
<view class="components-checkbox-icon jc-center ai-center" :class="{'isSelected':isSelected}" @click="change">
<image class="icon-hook" :src="webUrl + '/20240109175325131970.png'" mode="scaleToFill" v-if="isSelected"/>
</view>
</template>
<script>
export default {
name: 'CheckboxIcon',
props: {
defaultState: {
type: Boolean,
default: false
},
mark: {
type: Array,
default: () => {
return []
}
}
},
data() {
return {
webUrl: Object.freeze(this.$VUE_APP_RESOURCES_URL)
}
},
computed: {
isSelected: function() {
return this.defaultState
}
},
methods: {
change() {
this.$emit('change', !this.isSelected, this.mark)
}
}
}
</script>
<style scoped lang="less">
.components-checkbox-icon {
display: inline-flex;
width: 32rpx;
height: 32rpx;
box-sizing: border-box;
border: 2rpx solid #D5D7D8;
border-radius: 50%;
}
.icon-hook {
width: 24rpx;
height: 24rpx;
}
.isSelected {
border: 3px solid #FD5749;
background: #FD5749;
}
</style>