editName.vue 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view>
  3. <view class="bg-white m mt-10 w editName">
  4. <u-input placeholder="请输入" v-model="nickname" border="none" fontSize="24rpx"></u-input>
  5. </view>
  6. <u-text text="请输入2~20个字符" type="info" size="24rpx" margin="10rpx 0 0 48rpx"></u-text>
  7. <u-button
  8. text="保存"
  9. color="var(--theme)"
  10. :disabled="disabled"
  11. @click="save"
  12. shape="circle"
  13. customStyle="width: 650rpx;height: 98rpx; position:fixed;bottom:100rpx;left:50%;transform:translate(-50%)"
  14. ></u-button>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. nickname: this.$store.state.user.nickname
  22. }
  23. },
  24. computed: {
  25. disabled() {
  26. return (
  27. this.nickname == this.$store.state.user.nickname ||
  28. this.nickname.length < 2 ||
  29. this.nickname.length > 20
  30. )
  31. }
  32. },
  33. methods: {
  34. save() {
  35. uni.$emit('editName', this.nickname)
  36. this.$common.back()
  37. }
  38. }
  39. }
  40. </script>
  41. <style lang="scss" scoped>
  42. .editName {
  43. height: 80rpx;
  44. display: flex;
  45. align-items: center;
  46. border-radius: 8px;
  47. }
  48. </style>