beizhu.vue
3.02 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
<!-- 全屏遮罩层 -->
<view v-if="show" class="mask" @click="maskClose">
<!-- 底部弹窗主体 -->
<view class="popup-wrap" @click.stop>
<view class="desc-container">
<view class="title">
<view @click="show = false">
<up-icon name="close" color="#fff" size="20"></up-icon>
</view>
<text class="titleName">动作备注</text>
<view class="btn" @click="saveNoteContent">保存</view>
</view>
<view class="area-box">
<!-- <up-textarea v-model="tempNoteContent" placeholder="此处填写个人备注" class="noteConten"
customStyle="border-radius:12rpx; padding:20rpx;background: #242424;" /> -->
<textarea class="textarea" v-model="tempNoteContent" placeholder="此处填写个人备注" />
</view>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
const show = ref(false);
const tempNoteContent = ref(''); // 临时编辑的备注内容
const emit = defineEmits(['saveSuccess']);
const props = defineProps({
oldNote: {
type: String,
default: ''
}
})
// 保存备注
const saveNoteContent = async () => {
const content = tempNoteContent.value.trim();
if (!content) {
uni.showToast({ title: '备注不能为空', icon: 'none' });
return;
}
emit('saveSuccess', content);
show.value = false;
};
// 打开弹窗
const open = () => {
tempNoteContent.value = props.oldNote
show.value = true;
};
// 遮罩点击关闭
const maskClose = () => {
show.value = false;
};
defineExpose({ open });
</script>
<style lang="scss" scoped>
// 全屏灰色遮罩
.mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
z-index: 999;
display: flex;
flex-direction: column;
justify-content: flex-end;
}
// 底部弹窗容器,控制弹出动画、圆角、背景
.popup-wrap {
width: 100%;
border-radius: 16rpx 16rpx 0 0; // 对应原来 round="16"
overflow: hidden;
// 弹出动画可选,不需要可删除
animation: popUp 0.24s ease-out;
}
@keyframes popUp {
from {
transform: translateY(100%);
}
to {
transform: translateY(0);
}
}
.desc-container {
background-color: #1a1a1a; // 这里直接改弹窗背景色,非常方便
padding: 40rpx 30rpx 40rpx;
height: 75vh;
.title {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: 500;
text-align: center;
color: #fff;
font-size: 32rpx;
margin-bottom: 40rpx;
}
.titleName {
flex: 1;
text-align: center;
}
.area-box {
.textarea {
width: 95%;
height: 300rpx;
background: #444;
color: #fff;
border-radius: 16rpx;
padding: 20rpx;
font-size: 30rpx;
border: 0;
}
}
.btn {
width: 100rpx;
height: 50rpx;
background-color: #fedc1f;
color: #000;
border-radius: 30rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 28rpx;
}
}
</style>