首页 > 代码库 > MUI 语音搜索框
MUI 语音搜索框
<div id="search-area">
<div class="mui-input-row mui-search mui-active" style="width: 85vw; display: inline-block;margin-left: 5px;">
<input id="search" type="search" class="mui-input-speech mui-input-clear" placeholder="" data-input-clear="2" data-input-speech="2" data-input-search="2">
<span class="mui-icon mui-icon-clear mui-hidden"></span>
<span class="mui-icon mui-icon-speech"></span>
<span class="mui-placeholder">
<span class="mui-icon mui-icon-search" id="search-btn"></span>
<span>带语音输入的搜索框</span>
</span>
</div>
<div id="search-text">搜索</div>
</div>
// 语音输入 var text = null; function startRecognize() { var options = {}; options.engine = ‘iFly‘; options.punctuation = false; // 是否需要标点符号 text = ""; console.log("开始语音识别:"); plus.speech.startRecognize(options, function(s) { console.log(s); text += s; document.getElementById(‘search‘).value = http://www.mamicode.com/text;"语音识别失败:" + e.message); alert("语音识别失败:" + e.message); }); setTimeout(stopRecognize, 10000); } // 停止语音输入 function stopRecognize() { plus.speech.stopRecognize(); }
MUI 语音搜索框
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。