Closed yexiaoyu123 closed 1 month ago
把代码贴出来
把代码贴出来
<!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>
dialog包含文本框并设置前后图标时控制台会报错
Uncaught (in promise) TypeError: Failed to execute 'animate' on 'Element': duration must be non-negative or auto
代码: