欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

vue.js實現(xiàn)h5機器人聊天(測試版)

 更新時間:2020年07月16日 09:30:04   作者:菜鳥老五  
這篇文章主要為大家詳細(xì)介紹了vue.js實現(xiàn)h5機器人聊天測試版,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了vue.js實現(xiàn)h5機器人聊天的具體代碼,供大家參考,具體內(nèi)容如下

<!DOCTYPE html>
<html>
 
 <head>
 <meta charset="UTF-8">
 <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
 <title>登錄</title>
 <link rel="stylesheet" href="css/mui.css" />
 </head>
 <style>
 page {
 background-color: #ececec;
 }
 
 .reply .pic,
 .send .pic {
 border-radius: 50%;
 padding: 10px;
 }
 
 .reply,
 .send {
 display: flex;
 }
 
 .reply .pic image,
 .send .pic image {
 border-radius: 50%;
 width: 80rpx;
 height: 80rpx;
 }
 
 .send {
 justify-content: flex-end;
 }
 
 .reply .content {
 padding: 10px 10px 10px 0;
 max-width: 480rpx;
 }
 
 .send .content {
 padding: 10px 0 10px 10px;
 max-width: 480rpx;
 }
 
 .reply .content .text,
 .send .content .text {
 background-color: #fff;
 border-radius: 5px;
 padding: 10px;
 font-size: 16px;
 }
 
 .send .content .text {
 background-color: #78fd75;
 }
 
 .sendMessage {
 display: flex;
 position: fixed;
 bottom: 0;
 left: 0;
 right: 0;
 padding: 10px;
 background-color: #fff;
 }
 
 .inputMsg {
 flex: 2;
 background-color: #fff;
 height: 30px;
 font-size: 16px;
 padding: 5px 10px;
 border-bottom: 1px solid #ddd;
 }
 
 .sendMessage {
 position: fixed;
 bottom: 0px;
 width: 100%;
 height: 60px;
 line-height: 60px;
 background-color: #4CD964;
 }
 
 #inputs {
 position: absolute;
 display: inline-block;
 width: 65%;
 height: 40px;
 background-color: #fff;
 border-radius: 3px;
 }
 
 #btn_submit {
 position: absolute;
 width: 100px;
 display: inline-block;
 right: 10px;
 height: 40px;
 background-color: #DD524D;
 border: 0px;
 text-align: center;
 color: #fff;
 }
 
 .image {
 
 width: 60px;
 border-radius: 50%;
 height: 60px;
 }
 </style>
 
 <body>
 <header class="mui-bar mui-bar-nav">
 <h1 class="mui-title">老五</h1>
 </header>
 <div class="mui-content">
 
 <!--chat.wxml-->
 <div id="cont">
 
 <div >
 
 <!--<div v-if="{{item.type == 1}}">-->
 <div class="reply">
 <div class="pic">
 <image class="image" src="img/list_img.png"></image>
 </div>
 <div class="content">
 <div class="text">
 {{hh}}
 </div>
 </div>
 </div>
 <!--</div>-->
 <!--<div v-if="{{item.type == null}}">-->
 <div class="send">
 <div class="content">
 <div class="text">
 {{names}}
 </div>
 </div>
 <div class="pic">
 <image class="image" src="img/list_img.png"></image>
 </div>
 </div>
 <!--</div>-->
 </div>
 
 <div class="sendMessage">
 <input id="inputs" type="text" placeholder="請輸入您要說的話" />
 <button id="btn_submit" @click="mit()">發(fā)送</button>
 
 </div>
 
 </div>
 
 <!--<scroll-view scroll-y="true" style='margin-bottom:120rpx;' scroll-top="{{scrollTop}}">-->
 <!--<div is="temp" data="{{message}}"></div>-->
 <!--</scroll-view>-->
 
 </div>
 
 <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
 
 <script src="https://cdn.jsdelivr.net/npm/vue"></script>
 <script type="text/javascript" src="js/vue.min.js"></script>
 
 <script>
var str="";
 
 var vue = new Vue({
 el: "#cont",
 data: {
 message: [
 
 ],
 names: "what",
 hh:"你說啥",
 inputMsg: "",
 scrollTop: 0
 },
 methods: {
 mit: function() {
 var name = document.getElementById("inputs").value;
 console.log(name);
 if(name != "") {
 var msg = {
 type: 0,
 src: "http://tu.maomaogougou.cn/picture/2015/05/fa44ab7e634cbc7a8011939273b70375.jpg",
 texts: name
 };
 // //發(fā)送信息
 // this.Message(msg);
 // 1111111 console.log("124313535",this.names)
 this.names = name;
document.getElementById("inputs").value="";
 //回復(fù)
 $.ajax({
 type: "get",
 url: "http://www.tuling123.com/openapi/api",
 data: {
  key: "fa7f4d06b0a24b479d29ea0a01672350",
  info: msg.content
 },
 success: function(data) {
  console.log(data, "111111111111");
//  var reply = {
//  type: 1,
//  src: "http://tu.maomaogougou.cn/picture/2015/05/c53b650c3a5fd847688118e566d6673f.png",
//  content: data.text
//  };
 
str=data.text;
 
 }
 });
 
 
 }
 
 console.log(str,"str");
 this.hh=str; 
 // this.Messages(reply);
 },
// Message: function(msg) {
// var list = this.message;
// list.push(msg);
// this.message = list;
// console.log("Message", list);
//
// },
// Messages: function(msg) {
// var list = this.message;
// list.push(msg);
// this.message = list;
// console.log("2222222222", list);
//
// },
 },
 
 });
 </script>
 <script>
 </script>
 </body>
 
</html>

關(guān)于vue.js組件的教程,請大家點擊專題vue.js組件學(xué)習(xí)教程進行學(xué)習(xí)。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue實現(xiàn)鼠標(biāo)經(jīng)過顯示懸浮框效果

    vue實現(xiàn)鼠標(biāo)經(jīng)過顯示懸浮框效果

    這篇文章主要為大家詳細(xì)介紹了vue實現(xiàn)鼠標(biāo)經(jīng)過顯示懸浮框效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • Vue3.0監(jiān)聽器watch與watchEffect詳解

    Vue3.0監(jiān)聽器watch與watchEffect詳解

    在 Vue 3 中,watch 仍然是一種用于監(jiān)聽數(shù)據(jù)變化并執(zhí)行相應(yīng)操作的方式,不過在組合式 API 中,watch 的使用方式與選項式 API 略有不同,這篇文章主要介紹了Vue3.0監(jiān)聽器watch與watchEffect,需要的朋友可以參考下
    2023-12-12
  • Vue?electron零基礎(chǔ)使用教程

    Vue?electron零基礎(chǔ)使用教程

    Electron也可以快速地將你的網(wǎng)站打包成一個原生應(yīng)用發(fā)布,下面這篇文章主要給大家介紹了關(guān)于Vue和React中快速使用Electron的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-10-10
  • 新手vue構(gòu)建單頁面應(yīng)用實例代碼

    新手vue構(gòu)建單頁面應(yīng)用實例代碼

    本篇文章主要介紹了新手vue構(gòu)建單頁面應(yīng)用實例代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-09-09
  • 關(guān)于vuex狀態(tài)刷新網(wǎng)頁時數(shù)據(jù)被清空問題及解決

    關(guān)于vuex狀態(tài)刷新網(wǎng)頁時數(shù)據(jù)被清空問題及解決

    這篇文章主要介紹了關(guān)于vuex狀態(tài)刷新網(wǎng)頁時數(shù)據(jù)被清空問題及解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-07-07
  • vue-draggable實現(xiàn)拖拽表單的示例代碼

    vue-draggable實現(xiàn)拖拽表單的示例代碼

    本文主要介紹了vue-draggable實現(xiàn)拖拽表單的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-05-05
  • 淺析Vue3中的邏輯復(fù)用

    淺析Vue3中的邏輯復(fù)用

    這篇文章主要為大家詳細(xì)介紹了Vue3中邏輯復(fù)用的相關(guān)知識,文中的示例代碼簡潔易懂,對我們深入了解Vue3有一定的幫助,需要的小伙伴可以參考下
    2023-12-12
  • vue基于兩個計算屬性實現(xiàn)選中和全選功能示例

    vue基于兩個計算屬性實現(xiàn)選中和全選功能示例

    這篇文章主要介紹了vue基于兩個計算屬性實現(xiàn)選中和全選功能,結(jié)合實例形式分析了vue計算屬性get及set操作頁面元素實現(xiàn)選中與全選功能相關(guān)操作技巧,需要的朋友可以參考下
    2019-02-02
  • vue如何通過點擊事件實現(xiàn)頁面跳轉(zhuǎn)詳解

    vue如何通過點擊事件實現(xiàn)頁面跳轉(zhuǎn)詳解

    頁面跳轉(zhuǎn),我們一般都通過路由跳轉(zhuǎn)實現(xiàn),通常情況下可直接使用router-link標(biāo)簽實現(xiàn)頁面跳轉(zhuǎn),下面這篇文章主要給大家介紹了關(guān)于vue如何通過點擊事件實現(xiàn)頁面跳轉(zhuǎn)的相關(guān)資料,需要的朋友可以參考下
    2022-07-07
  • vue中通過使用$attrs實現(xiàn)組件之間的數(shù)據(jù)傳遞功能

    vue中通過使用$attrs實現(xiàn)組件之間的數(shù)據(jù)傳遞功能

    組件之間傳遞數(shù)據(jù)的方式有很多種,之所以有這么多種方式,是為了滿足在不同場景不同條件下的使用。這篇文章主要介紹了vue中通過使用$attrs實現(xiàn)組件之間的數(shù)據(jù)傳遞,需要的朋友可以參考下
    2019-09-09

最新評論