<template>
  <view class="user_info">
    <view class="center">
      <u-input
        placeholder="请输入名称"
        border="bottom"
        clearable
        v-model="value"
      ></u-input>
      <button class="btn" @tap="submit">保存</button>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        value: '',
      }
    },
    onLoad(options) {
      this.value = options.value
    },
    methods: {
      submit() {
        if (this.value) {
          uni.showToast({
            title: '修改成功',
            icon: 'success',
          })
          setTimeout(() => {
            uni.navigateBack()
          }, 1500)
        } else {
          uni.showToast({
            title: '请输入名称',
            icon: 'none',
          })
        }
      },
    },
  }
</script>

<style lang="scss" scoped>
  .center {
    padding: 40rpx 24rpx;
    .btn {
      height: 88rpx;
      border-radius: 40rpx;
      font-size: 28rpx;
      text-align: center;
      line-height: 88rpx;
      border: 0;
      margin-top: 140rpx;
      background-color: #ec7c00;
      color: white;
    }
  }
</style>
