ionic:在何处查看显示的控制台日志 [英] ionic: where to see the displayed console log

查看:189
本文介绍了ionic:在何处查看显示的控制台日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是离子的新手,我正在关注



第3步:您将在右侧窗口和左侧应用程序屏幕上看到一个带有HTML元素的窗口,您可以在其中检查设计的代码。





St ep 4:在右侧窗口中,您可以在顶部栏中找到控制台菜单选项。单击,您将进入控制台,您可以在其中找到生成离子的应用程序日志错误警告







编辑:



对于实际-设备模拟器 genymotion 控制台日志,请检查以下步骤&



步骤1:运行此命令可在真实设备或仿真器上运行您的应用程序

  $ ionic cordova运行android 

步骤2:在设备或仿真器上成功启动应用后,转到Chrome浏览器并按右键 + 单击,然后单击检查 ,您将进入浏览器底部的屏幕下方。





步骤3:单击远程设备 ,将显示已连接的真实设备或仿真器列表。



从该设备列表中,单击检查该设备名称右侧的按钮(检查屏幕快照是否相同)将打开一个带有设备镜像的新窗口,现在所有控制台都在您的调试器中玩。







希望这将帮助您调试应用程序。


I am new to ionic I am following ionic framework documents to learn it.

Here is my method's code: hello-ionic.ts

  openActionSheet(){
    let actionSheet=this.actionsheetCtrl.create(
    {
        title: 'Modify your album',
        cssClass: 'page-hello-ionic',
        buttons:[
          {
            text: 'Delete',
            role: 'destructive', //will always sort to be on top
            icon: !this.platform.is('ios') ? 'trash' : null,
            handler: () => {
              console.log('Delete clicked');
            }
          },
          {
          text: 'Play',
          icon: !this.platform.is('ios') ? 'arrow-dropright-circle' : null,
          handler: () => {
            console.log('Play clicked');
          }   
        },
        {
          text: 'Favorite',
          icon: !this.platform.is('ios') ? 'heart-outline' : null,
          handler: () => {
            console.log('Favorite clicked');
          }
        },
        {
          text: 'Cancel',
          role: 'cancel', // will always sort to be on the bottom
          icon: !this.platform.is('ios') ? 'close' : null,
          handler: () => {
            console.log('Cancel clicked');
          }
        }
      ]});
    actionSheet.present();
  }
  

The code works fine. But I want to know that where is console.log() printed. Can anyone help me with that?

解决方案

To check console log you can use browser and run below command:

Step 1: $ionic serve (will run you app on localhost)

Step 2: In your respective browser (chrome, safari, etc...) where your app is running Right + click and inspect your app as per below screenshot.

Step 3: You will get a window with HTML elements on the right side window and on left your app screen where you can check your designed code.

Step 4: On the right side window, you can find "Console" menu option on top bar. Click on that you will get your console where you find your app logs or error or warning which ionic generated.

EDIT:

For real-device or emulator or genymotion console log check below steps & screenshots.

Step 1: Run this command to run your app on real-device or emulator

$ionic cordova run android

Step 2: After successfully launch the app on device or emulator Go to Chrome browser and Right + click and click on "Inspect" and you will get below screen at bottom of your browser.

Step 3: Click on "Remote devices" will show connected real device or emulator list.

From that device list click on "Inspect" button on the right side of that device name(check screenshot for the same) will open a new window with your device mirror now all console is yours play around this debugger.

Hope this will help you to debug your app.

这篇关于ionic:在何处查看显示的控制台日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆