123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <view class="footer">
- <view class="footer-left">
- <!-- <view class="uni-icon uni-icon-mic" @tap="startRecognize"> </view> -->
- </view>
- <view class="footer-center">
- <input class="input-text" type="text" v-model="inputValue"></input>
- </view>
- <view class="footer-right" @tap="sendMessge">
- <view id='msg-type' >发送</view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "chat-input",
- data() {
- return {
- inputValue: ''
- }
- },
- methods: {
- startRecognize: function () {
- var options = {};
- var that = this;
- options.engine = 'iFly';
- that.inputValue = "";
- plus.speech.startRecognize(options, function (s) {
- console.log(s);
- that.inputValue += s;
- }, function (e) {
- console.log("语音识别失败:" + e.message);
- });
- },
- sendMessge: function () {
- var that = this;
- if (that.inputValue.trim() == '') {
- that.inputValue = '';
- } else {
- //点击发送按钮时,通知父组件用户输入的内容
- this.$emit('send-message', {
- type: 'text',
- content: that.inputValue
- });
- that.inputValue = '';
- }
- }
- }
- }
- </script>
- <style>
- @import "../common/icon.css";
- .footer {
- display: flex;
- flex-direction: row;
- width: 100%;
- height: 80px;
- min-height: 80px;
- border-top: solid 1px #bbb;
- overflow: hidden;
- padding: 5px;
- background-color: #fafafa;
- }
- .footer-left {
- width: 40px;
- height: 80px;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .footer-right {
- width: 120px;
- height: 80px;
- display: flex;
- justify-content: center;
- align-items: center;
- color: #1482D1;
- }
- .footer-center {
- flex: 1;
- height: 80px;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .footer-center .input-text {
- flex: 1;
- background: #fff;
- border: solid 1px #ddd;
- padding: 10px !important;
- font-family: verdana !important;
- overflow: hidden;
- border-radius: 15px;
- height: 38px;
- }
- </style>
|