export default <LibMixins>{

    data(){
      return {
          searchDataValue:false,
          searchData:undefined
      }
    },

    methods:{

        search(obj){
            this.closeSearch();
            return this.$request({
                url:'player/search',
                data:{
                    keywords: obj.data.value
                },
                token:true,
                failMessage:true
            }).then((data)=>{
                return obj.success(data.data);
            }).catch(obj.none);

        },

        searchSuccess(data){
            this.openSearch();
            this.searchData = data;
        },

        searchEmpty(){
            this.closeSearch();
        },

        openSearch(){
            if (!this.searchDataValue) {
                this.searchDataValue = true;
            }
        },

        closeSearch(){
            if (this.searchDataValue) {
                this.searchDataValue = false;
            }
        }
    }

}