Browse Source

update MessageStream.vue

reghao 2 years ago
parent
commit
cb41590a40
1 changed files with 23 additions and 5 deletions
  1. 23 5
      src/views/home/MessageStream.vue

+ 23 - 5
src/views/home/MessageStream.vue

@@ -43,11 +43,20 @@
       </el-row>
       <el-row style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
         <el-card class="box-card">
-          <div slot="header" class="clearfix">
-            <el-row>
-              <span>热门文章</span>
-            </el-row>
-          </div>
+          <el-input
+            v-model="text"
+            type="textarea"
+            :rows="3"
+            placeholder="有什么新鲜事想分享给大家?"
+          />
+          <el-row style="text-align: right">
+            <el-button
+              size="mini"
+              type="submit"
+              class="el-icon-message"
+              @click="onSubmit"
+            >发送</el-button>
+          </el-row>
         </el-card>
       </el-row>
     </el-col>
@@ -70,6 +79,7 @@ export default {
   data() {
     return {
       dataList: [],
+      text: '',
       websocket: null
     }
   },
@@ -95,6 +105,14 @@ export default {
     clear() {
       this.dataList = []
     },
+    onSubmit() {
+      this.$notify({
+        message: this.text,
+        type: 'info',
+        duration: 1000
+      })
+      this.text = ''
+    },
     initWebSocket: function() {
       var url = 'wss://api.reghao.cn/ws/log?token=1234567890'
       this.websock = new WebSocket(url)