首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >文本区域中的离子放置结果

文本区域中的离子放置结果
EN

Stack Overflow用户
提问于 2021-01-16 01:13:06
回答 1查看 17关注 0票数 0

嗯,我有一个程序,它使用来自Ionic的speechRecognition插件,它接受侦听并将结果放在警报中,可以将结果信息放入输入或文本区域,这是我的代码

代码语言:javascript
复制
import { Component } from '@angular/core';
import { SpeechRecognition } from '@ionic-native/speech-recognition/ngx'

@Component({
  selector: 'app-voicetext',
  templateUrl: './voicetext.page.html',
  styleUrls: ['./voicetext.page.scss'],
})

export class VoicetextPage {
  
  constructor( private speechRecognition: SpeechRecognition) {}
  
  startListening() {
    this.speechRecognition.startListening().subscribe((speeches)=>{
      alert(speeches[0]);
    },(err)=>{
      alert(JSON.stringify(err));
    })
  }

}

Este es mi HTML

代码语言:javascript
复制
<ion-header
    <ion-title color="light">Voz a Texto</ion-title>
</ion-header>

<ion-content>

  <ion-button 
  (click)="startListening()">
  </ion-button>

 <ion-card class="ion-padding-horizontal">

  <ion-textarea 
  rows="15" cols="20" 
  ></ion-textarea> 

</ion-card>

</ion-content>

EN

回答 1

Stack Overflow用户

发布于 2021-01-16 01:21:49

代码语言:javascript
复制
const myInput = document.querySelector(".myInput");
const myTextarea = document.querySelector(".myTextarea");

myInput.value = "I'm an input value";
myTextarea.innerHTML = "I'm an textarea innerHTML";
代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <input type="text" class="myInput">
  <textarea cols="20" rows="5" class="myTextarea"></textarea>
</body>
</html>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65740554

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档