beizhu.vue
2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<template>
<up-popup :show="show" mode="bottom" round="16" closeable @close="show = false" :safeAreaInsetBottom="false">
<view class="desc-container">
<view class="title">动作备注</view>
<view class="input-box">
<up-textarea
v-model="tempNoteContent"
placeholder="此处填写个人备注"
autoHeight
border="none"
customStyle="background: #242424; padding: 20rpx; border-radius: 12rpx; color: #fff"
placeholderStyle="color: #999"
></up-textarea>
</view>
<view class="footer">
<view class="btn" @click="saveNoteContent">保存</view>
</view>
</view>
</up-popup>
</template>
<script setup>
import { ref } from 'vue';
const show = ref(false);
const tempNoteContent = ref(''); // 临时编辑的备注内容
const emit = defineEmits(['saveSuccess']);
// 保存备注
const saveNoteContent = async () => {
const content = tempNoteContent.value.trim();
// 如果内容为空,直接返回,不提交
if (!content) {
uni.showToast({ title: '备注不能为空', icon: 'none' });
return;
}
emit('saveSuccess', content);
// 关闭弹窗
show.value = false;
};
const open = () => {
show.value = true;
};
defineExpose({ open });
</script>
<style lang="scss" scoped>
.desc-container {
background-color: #1a1a1a;
padding: 40rpx 30rpx 40rpx;
.title {
color: #fff;
font-size: 32rpx;
font-weight: 500;
text-align: center;
margin-bottom: 40rpx;
}
.input-box {
margin-bottom: 60rpx;
/* 穿透修改 u-textarea 内部文字颜色 */
:deep(.u-textarea__field) {
color: #ccc !important;
}
}
.footer {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
.btn {
width: 100%;
height: 80rpx;
background-color: #fedc1f;
color: #333;
border-radius: 12rpx;
text-align: center;
line-height: 80rpx;
}
}
}
</style>