Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) TypeError: Failed to execute 'animate' on 'Element': duration must be non-negative or auto #354

Closed
yexiaoyu123 opened this issue Oct 8, 2024 · 2 comments

Comments

@yexiaoyu123
Copy link

yexiaoyu123 commented Oct 8, 2024

dialog包含文本框并设置前后图标时控制台会报错
Uncaught (in promise) TypeError: Failed to execute 'animate' on 'Element': duration must be non-negative or auto
Screenshot_6

代码:
Screenshot_7

@zdhxiong
Copy link
Owner

zdhxiong commented Oct 9, 2024

把代码贴出来

@yexiaoyu123
Copy link
Author

把代码贴出来

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test</title>
    <link rel="stylesheet" href="https://unpkg.com/mdui@2/mdui.css">
    <script src="https://unpkg.com/mdui@2/mdui.global.js"></script>
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <!-- Outlined -->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Outlined" rel="stylesheet">
    <!-- Rounded -->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Round" rel="stylesheet">
    <!-- Sharp -->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Sharp" rel="stylesheet">
    <!-- Two Tone -->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons+Two+Tone" rel="stylesheet">
</head>
<body>
    <mdui-dialog class="example-dialog">
        Dialog
        <mdui-text-field label="Text Field">
            <mdui-button-icon slot="icon" icon="search"></mdui-button-icon>
            <mdui-button-icon slot="end-icon" icon="mic"></mdui-button-icon>
        </mdui-text-field>
        <mdui-button>关闭</mdui-button>
    </mdui-dialog>
    <mdui-button>打开对话框</mdui-button>

<script>
  const dialog = document.querySelector(".example-dialog");
  const openButton = dialog.nextElementSibling;
  const closeButton = dialog.querySelector("mdui-button");
  openButton.addEventListener("click", () => dialog.open = true);
  closeButton.addEventListener("click", () => dialog.open = false);
</script>
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants