为啥?我电脑启动QtScrcpy.exe这个程序,电脑桌面显示手机画面不到3秒钟,就消失没了?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了为啥?我电脑启动QtScrcpy.exe这个程序,电脑桌面显示手机画面不到3秒钟,就消失没了?相关的知识,希望对你有一定的参考价值。

QtScrcpy.exe是安卓数据线投屏软件,因为是一个免费软件有点问题,兼容性不好也是正常。

打开QtScrcpy.exe,同时手机在开发者模式中打开USB调试:

    用数据线连接电脑

    软件界面adb的“执行”

    设备序列号自动获取成功

    启动服务

参考技术A 可能是启动文件出问题了。

,为啥这个 JavaScript 程序(DIGITAL TIMER)不工作,当我点击它来启动计时器时?

【中文标题】,为啥这个 JavaScript 程序(DIGITAL TIMER)不工作,当我点击它来启动计时器时?【英文标题】:Do anybody know, why this JavaScript program (DIGITAL TIMER) is not working, when I click it to start the timer?有谁知道,为什么这个 JavaScript 程序(DIGITAL TIMER)不工作,当我点击它来启动计时器时? 【发布时间】:2021-12-12 02:15:46 【问题描述】:

有人知道,为什么当我点击这个 JavaScript 程序 (DIGITAL TIMER) 来启动计时器时它不起作用?

这是 HTML 代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>
<body>
    <div class="timer-container">
        <h1 id="timer-display">00:00:00</h1>
    </div> 
    <script src="script.js"></script>
</body>
</html>

这是 CSS 代码:

body
    font-family: "Software Tester 7";
    background-color: black;


.timer-container
    background-color: yellow-green;
    border: 5px solid gray;
    border-radius: 2px;
    margin-top: 19%;


h1
    color: white;
    text-align: center;
    font-size: 120px;
    margin: 0;

这是 JavaScript 代码:

var timeBegan = null; // did the clock start?
var timeStopped = null; // at what time was the timer stopped?
var stoppedDuration = 0; // how long was the timer stopped?
var startInterval = null; // this is needed to stop the startInterval() method
var flag = false; // to control the start/stop of the timer

const timerContainer = document.getElementsByClassName("timer-container")[0];

timerContainer.addEventListener("click", function()

    if(!flag)
    
        startTimer();
        flag = true;
    
    else
    
        stopTimer();
        flag = false;
    
)
function startTimer()

    if(timeBegan === null)
        timeBegan = new Date();

    if(timeStopped !== null)
        stoppedDuration += (new Date() - timeStopped);

    startInterval = setInterval(clockRunning, 10);


function stopTimer()

    timeStopped = new Date();
    clearInterval(startInterval);

function clockRunning()
   
var currentTime = new Date
var timeElapsed = new Date(currentTime - timeBegan - stoppedDuration);

var minutes = timeElapsed.getUTCMinutes();
var seconds = timeElapsed.getUTCSeconds();
var milliseconds = timeElapsed.getUTCMilliseconds();

milliseconds = Math.floor(milliseconds/10);

document.getElementById("timer.display").innerHTML = 
(minutes = minutes < 10 ? '0' + minutes:minutes) + ":" +
(seconds = seconds < 10 ? '0' + seconds:seconds) + ":" +
(milliseconds = milliseconds < 10 ? '0' + milliseconds:milliseconds);

我希望有人能真正帮助我解决我的问题。

来自这个 YouTube 教程:“https://www.youtube.com/watch?v=_bvutuhUxHY&ab_channel=codefoxx”。

非常感谢您的及时答复:)

【问题讨论】:

const timerContainer 移动到函数体中。 您检查您的开发者控制台是否有错误? 【参考方案1】:

这是一个很小的错误

您的时钟 ID 是 timer-display,但在 clockRunning 函数中,您已将其用作 timer.display

其他一切都很好 点击定时器开始运行,再次点击停止定时器,

注意:如果你想默认启动计时器,那么在 body onload 上调用 startTimer 函数

var timeBegan = null; // did the clock start?
var timeStopped = null; // at what time was the timer stopped?
var stoppedDuration = 0; // how long was the timer stopped?
var startInterval = null; // this is needed to stop the startInterval() method
var flag = false; // to control the start/stop of the timer

const timerContainer = document.getElementsByClassName("timer-container")[0];

timerContainer.addEventListener("click", function()

    if(!flag)
    
        startTimer();
        flag = true;
    
    else
    
        stopTimer();
        flag = false;
    
)
function startTimer()

    if(timeBegan === null)
        timeBegan = new Date();

    if(timeStopped !== null)
        stoppedDuration += (new Date() - timeStopped);

    startInterval = setInterval(clockRunning, 10);


function stopTimer()

    timeStopped = new Date();
    clearInterval(startInterval);

function clockRunning()
   
var currentTime = new Date
var timeElapsed = new Date(currentTime - timeBegan - stoppedDuration);

var minutes = timeElapsed.getUTCMinutes();
var seconds = timeElapsed.getUTCSeconds();
var milliseconds = timeElapsed.getUTCMilliseconds();

milliseconds = Math.floor(milliseconds/10);

document.getElementById("timer-display").innerHTML = 
(minutes = minutes < 10 ? '0' + minutes:minutes) + ":" +
(seconds = seconds < 10 ? '0' + seconds:seconds) + ":" +
(milliseconds = milliseconds < 10 ? '0' + milliseconds:milliseconds);
body
    font-family: "Software Tester 7";
    background-color: black;


.timer-container
    background-color: yellow-green;
    border: 5px solid gray;
    border-radius: 2px;
    margin-top: 19%;


h1
    color: white;
    text-align: center;
    font-size: 120px;
    margin: 0;
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>
<body>
    <div class="timer-container">
        <h1 id="timer-display">00:00:00</h1>
    </div> 
    
</body>
</html>

【讨论】:

以上是关于为啥?我电脑启动QtScrcpy.exe这个程序,电脑桌面显示手机画面不到3秒钟,就消失没了?的主要内容,如果未能解决你的问题,请参考以下文章

为啥我的引导加载程序无法在最近的笔记本电脑上运行?

为啥rabbitMQ启动特别慢

为啥我的电脑的第一启动项是Removable Devices

为啥我的电脑无法启动游戏

为啥启动不了逍遥模拟器。是啥问题。我电脑是win10专业版。 启动不了,就会出现这个提示。

为啥开机自启动总是无法执行xmodmap 的命令