nickname.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <div class="username-container p-h-12">
  3. <van-field v-model="nickname" clearable label="昵称" placeholder="请输入" input-align="right" />
  4. <div class="btn" @click="handleSaveOperate">submit</div>
  5. </div>
  6. </template>
  7. <script>
  8. import updateUserInfoMixin from './updateUserInfo.mixin'
  9. export default {
  10. name: 'Nickname',
  11. mixins: [
  12. updateUserInfoMixin
  13. ],
  14. created() {
  15. this.nickname = this.$store.state.user.nickname
  16. },
  17. data() {
  18. return {
  19. nickname: ''
  20. }
  21. },
  22. methods: {
  23. handleSaveOperate() {
  24. const nickname = this.nickname
  25. if (!nickname) return this.$toast.fail('昵称尚未填写')
  26. const params = {
  27. type: 2,
  28. nickname: this.nickname
  29. }
  30. this.put_userinfo(params, true)
  31. },
  32. }
  33. }
  34. </script>
  35. <style lang="less">
  36. .username {
  37. &-container {
  38. margin-top: 10px;
  39. background-color: #fff;
  40. }
  41. }
  42. </style>