我要如何显示特定用户?

时间:2019-03-01 05:58:23

标签: javascript node.js vue.js socket.io

this is chat module这是我的输出:

enter image description here

完全正常。如果我单击任何用户,则打开聊天框,可以正常进行聊天。

但是问题是我不需要用户列表。我只希望消息是用户添加后的消息。 vue.js,node.js和socket.io 如果您需要其他部分,我不明白我在此处输入了哪些代码 显示视图

@extends('layouts.master')

@section('content')
{{-- {{DD($posts)}} --}}
 <style media="screen">
    .online{
        color: #32CD32;
    }
    .ffside {
        height: 100%;
        position: fixed;
        z-index: 1;
        top: 0;
        right: 0;
        width: 18em;
        overflow-x: hidden;
        padding-top: 50px;
    }
    .chat_box{
        width:260px;
        padding: 5px;
        position: fixed;
        bottom: 0px;
    }
    </style>
<div class="container">
		@foreach($posts as $key=>$post) 
			
		<div class="col-sm-8 my-4">
   			 <div class="card center">

       			 <img class="card-img-top" src="img/user1.jpg" alt="">
        		<div class="card-body">
              
           		 <a href="{{route('post.show',['id'=>$post->id])}}"><h2 class="card-title">{{$post->title}}</h2></a>
            	<p class="card-text">{{$post->category}}</p>
            	<p class="card-text">{{$post->title}}</p>
              <p class="card-text">{{$post->price}} </p>
            

                  
                    @foreach($images as $image)
                    @if($post->id == $image->post_id)
                     <p> <img class="card-img-top" src="{{ '/image/' . $image->image }}" ></p>
                   
                     @endif
                    @endforeach
                    
        		</div>        
   		 	 </div>

		</div>
		                <div class="card-body">

        <a href="#"> {{$post->name}} </a>
      </div>
        <div class="col-md-2" id="chatApp">
                <div class="panel panel-default ffside">
                    <div class="panel-heading">Users</div>
                    <div class="panel-body" style="padding:0px;">
                        <ul class="list-group">
                            <li class="list-group-item" v-for="chatList in chatLists" style="cursor: pointer;" @click="chat(chatList)">@{{ chatList.name }}  <i class="fa fa-circle pull-right" v-bind:class="{'online': (chatList.online=='Y')}"></i>  <span class="badge" v-if="chatList.msgCount !=0">@{{ chatList.msgCount }}</span></li>
                            <li class="list-group-item" v-if="socketConnected.status == false">@{{ socketConnected.msg }}</li>
                        </ul>
                    </div>
                </div>
            </div>
   
	
		</div>
		@endforeach


@endsection
@section('page-script')
    <script src="{{ asset('js/chat.js') }}" charset="utf-8"></script>
@stop

谢谢

0 个答案:

没有答案