beizhu.vue 1.91 KB
<template>
  <up-popup :show="show" mode="bottom" round="16" :safeAreaInsetBottom="false">
    <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="input-box">
        <up-textarea v-model="tempNoteContent" placeholder="此处填写个人备注" class="noteConten"
          customStyle="border-radius:12rpx; padding:20rpx;background: #242424;" />
      </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;
  height: 75vh;

  .title {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
    text-align: center;
    color: #fff;
    font-size: 32rpx;
    margin-bottom: 40rpx;
  }

  .btn {
    width: 100rpx;
    height: 50rpx;
    background-color: #fedc1f;
    color: #000;
    border-radius: 30rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28rpx;
  }

  .input-box {
    margin-bottom: 60rpx;

    // 输入文字白色
    :deep(.u-textarea__field) {
      color: #fff !important;
    }

  }
}
</style>