feat: add friends in account setting
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="account-user-new">
|
||||
<h3 class="subtitle is-3">{{ $tc('account.friends', localeUsers.length, { count: localeUsers.length }) }}</h3>
|
||||
<user-new v-if="user" v-model="user" />
|
||||
<h3 v-if="showTitle" class="subtitle is-3">{{ $tc('account.friends', localeUsers.length, { count: localeUsers.length }) }}</h3>
|
||||
<user-new v-if="user && defaultUser" v-model="user" />
|
||||
<div v-for="(user, k) in localeUsers" :key="k">
|
||||
<user-new v-model="localeUsers[k]" @remove="() => remove(k)" />
|
||||
</div>
|
||||
@@ -24,7 +24,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Model, Vue, Watch } from 'vue-property-decorator'
|
||||
import { Component, Model, Prop, Vue, Watch } from 'vue-property-decorator'
|
||||
import { Getter } from 'vuex-class'
|
||||
import IUser from '@/models/IUser'
|
||||
|
||||
@@ -38,6 +38,10 @@ export default class HelloWorld extends Vue {
|
||||
public user!: IUser | null
|
||||
@Model('input', { type: Array, required: true })
|
||||
public users!: IUser[]
|
||||
@Prop({ type: Boolean, default: true })
|
||||
public defaultUser!: boolean
|
||||
@Prop({ type: Boolean, default: true })
|
||||
public showTitle!: boolean
|
||||
public localeUsers: IUser[] = []
|
||||
public userId: string = ''
|
||||
public newUserId: string = ''
|
||||
@@ -72,6 +76,11 @@ export default class HelloWorld extends Vue {
|
||||
this.localeUsers.pop()
|
||||
}
|
||||
|
||||
@Watch('users')
|
||||
public onUsersChange(users: IUser[]): void {
|
||||
this.localeUsers = users
|
||||
}
|
||||
|
||||
@Watch('localeUsers')
|
||||
public onUserChange(users: IUser[]): void {
|
||||
this.$emit('input', users)
|
||||
|
||||
Reference in New Issue
Block a user