feat: 新增登录功能交互
This commit is contained in:
BIN
components/CheckBox/images/checked.png
Normal file
BIN
components/CheckBox/images/checked.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 805 B |
BIN
components/CheckBox/images/unchecked.png
Normal file
BIN
components/CheckBox/images/unchecked.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
35
components/CheckBox/index.vue
Normal file
35
components/CheckBox/index.vue
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<view class="checkbox-wrapper" @click="onChange">
|
||||
<image class="checkbox-icon" :src="isChecked" mode="aspectFit" />
|
||||
<slot></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, defineEmits } from "vue";
|
||||
import uncheckedIcon from "./images/unchecked.png";
|
||||
import checkedIcon from "./images/checked.png";
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:modelValue"]);
|
||||
|
||||
// 计算属性,确定当前是否选中
|
||||
const isChecked = computed(() => {
|
||||
return props.modelValue ? checkedIcon : uncheckedIcon;
|
||||
});
|
||||
|
||||
// 切换选中状态
|
||||
const onChange = () => {
|
||||
emit("update:modelValue", !props.modelValue);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import "./styles/index.scss";
|
||||
</style>
|
||||
12
components/CheckBox/propmt.md
Normal file
12
components/CheckBox/propmt.md
Normal file
@@ -0,0 +1,12 @@
|
||||
## 复选框组件
|
||||
|
||||
## 提示词:
|
||||
|
||||
使用 uniapp + vue3 组合式 api 开发微信小程序,要求如下:
|
||||
1、按照提供的图片高度还原交互设计
|
||||
2、要求布局样式结构简洁明了,class 命名请按照模块名称来命名,例如:.checkbox-wrapper
|
||||
3、可以使用 uniapp 内置的组件
|
||||
|
||||
## 备注
|
||||
|
||||
仅供学习、交流使用,请勿用于商业用途。
|
||||
10
components/CheckBox/styles/index.scss
Normal file
10
components/CheckBox/styles/index.scss
Normal file
@@ -0,0 +1,10 @@
|
||||
.checkbox-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.checkbox-icon {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user