|
|
Æ»¹ûϵͳרÓÃH5´´½¨Ò»¸öÂÌÉ«Îļþ
- // ´´½¨Ò»¸öÂÌÉ«Ö÷Ìâ·ç¸ñµÄ WebView ʾÀý
- function createGreenThemedWebViewExample() {
- // ´´½¨ WebView ʵÀý
- var web = new WebView();
-
- // ÏÔʾ½çÃæ
- web.show();
-
- // ¼ÓÔØÂÌÉ«Ö÷Ìâ·ç¸ñµÄ HTML ÄÚÈÝ
- web.loadHtml(`
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>ÉÁÖÄÁ³¡ÅäÖÃϵͳ</title>
- <link rel="stylesheet" href="https://lark-assets-prod-aliyun.oss-cn-hangzhou.aliyuncs.com/yuque/0/2025/css/44811133/1754534784655-d7b49f36-beac-4b87-bfd7-0f9d35594a1f.css?OSSAccessKeyId=LTAI4GKnqTWmz2X8mzA1Sjbv&Expires=1754536590&Signature=mdjtiAYrBBQLORJ9PKi6RdAatRY%3D&response-content-disposition=attachment%3Bfilename*%3DUTF-8%27%27all.min.css">
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- font-family: 'Comic Sans MS', 'Ó×Ô²', 'Microsoft YaHei', cursive, sans-serif;
- }
-
- body {
- background: linear-gradient(135deg, #90EE90, #32CD32);
- color: #006400;
- min-height: 100vh;
- overflow-x: hidden;
- padding: 20px;
- }
-
- /* Ö÷½çÃæÑùʽ */
- #main-container {
- max-width: 600px;
- margin: 0 auto;
- background: linear-gradient(135deg, #98FB98, #90EE90);
- border-radius: 25px;
- overflow: hidden;
- box-shadow: 0 15px 35px rgba(0, 100, 0, 0.4);
- border: 5px solid #228B22;
- position: relative;
- }
-
- .app-header {
- background: linear-gradient(90deg, #90EE90, #32CD32, #228B22);
- padding: 25px;
- text-align: center;
- position: relative;
- border-bottom: 5px solid #006400;
- }
-
- .app-header h1 {
- font-size: 2.2rem;
- font-weight: bold;
- letter-spacing: 2px;
- text-shadow: 3px 3px 0 #006400, 6px 6px 0 rgba(0, 0, 0, 0.2);
- color: #00FF00;
- margin: 10px 0;
- }
-
- .gold-nuggets {
- display: flex;
- justify-content: center;
- gap: 20px;
- margin: 20px 0;
- }
-
- .nugget {
- width: 60px;
- height: 60px;
- background: radial-gradient(circle at 30% 30%, #90EE90, #228B22);
- border-radius: 50%;
- border: 3px solid #006400;
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
- animation: float 3s ease-in-out infinite;
- }
-
- .nugget:nth-child(2) {
- animation-delay: 0.5s;
- }
-
- .nugget:nth-child(3) {
- animation-delay: 1s;
- }
-
- .start-method {
- display: flex;
- justify-content: center;
- gap: 25px;
- margin: 25px 0;
- padding: 0 20px;
- }
-
- .method-option {
- display: flex;
- flex-direction: column;
- align-items: center;
- cursor: pointer;
- background: rgba(255, 255, 255, 0.3);
- padding: 15px;
- border-radius: 15px;
- border: 3px solid #228B22;
- transition: all 0.3s ease;
- }
-
- .method-option:hover {
- transform: scale(1.05);
- background: rgba(255, 255, 255, 0.5);
- }
-
- .method-option.active {
- background: rgba(144, 238, 144, 0.7);
- box-shadow: 0 0 15px #00FF00;
- }
-
- .method-icon {
- width: 70px;
- height: 70px;
- background: radial-gradient(circle at 30% 30%, #90EE90, #228B22);
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-bottom: 10px;
- border: 3px solid #006400;
- box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
- }
-
- .method-icon i {
- font-size: 30px;
- color: #006400;
- }
-
- .method-option span {
- font-size: 16px;
- font-weight: bold;
- color: #006400;
- text-shadow: 1px 1px 0 #90EE90;
- }
-
- .app-list {
- padding: 25px;
- max-height: 60vh;
- overflow-y: auto;
- }
-
- .app-item {
- display: flex;
- align-items: center;
- padding: 20px;
- background: linear-gradient(90deg, #98FB98, #90EE90);
- border-radius: 15px;
- margin-bottom: 20px;
- transition: all 0.3s ease;
- border: 3px solid #228B22;
- box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
- }
-
- .app-item:hover {
- transform: translateY(-5px);
- box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
- background: linear-gradient(90deg, #AFEEEE, #98FB98);
- }
-
- .app-checkbox {
- margin-right: 20px;
- }
-
- .app-checkbox input {
- width: 25px;
- height: 25px;
- accent-color: #00FF00;
- cursor: pointer;
- }
-
- .app-info {
- flex: 1;
- }
-
- .app-name {
- font-weight: bold;
- font-size: 18px;
- margin-bottom: 8px;
- color: #006400;
- }
-
- .app-duration {
- font-size: 15px;
- color: #228B22;
- font-weight: bold;
- }
-
- .config-btn {
- background: linear-gradient(90deg, #228B22, #32CD32);
- color: white;
- border: none;
- border-radius: 10px;
- padding: 12px 20px;
- font-size: 16px;
- font-weight: bold;
- cursor: pointer;
- transition: all 0.3s ease;
- border: 2px solid #006400;
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
- }
-
- .config-btn:hover {
- opacity: 0.9;
- transform: scale(1.05);
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
- }
-
- /* ÅäÖýçÃæÑùʽ */
- .config-page {
- position: fixed;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- background: linear-gradient(135deg, #90EE90, #32CD32);
- z-index: 100;
- padding: 25px;
- overflow-y: auto;
- transform: scale(0);
- transition: transform 0.5s ease;
- display: none;
- }
-
- .config-page.active {
- transform: scale(1);
- display: block;
- }
-
- .config-header {
- display: flex;
- align-items: center;
- margin-bottom: 30px;
- padding-bottom: 20px;
- border-bottom: 5px solid #006400;
- background: linear-gradient(90deg, #98FB98, #90EE90);
- padding: 20px;
- border-radius: 15px;
- border: 3px solid #228B22;
- }
-
- .back-button {
- background: linear-gradient(90deg, #228B22, #32CD32);
- border: none;
- color: white;
- padding: 12px 20px;
- border-radius: 50px;
- cursor: pointer;
- display: flex;
- align-items: center;
- font-size: 16px;
- font-weight: bold;
- transition: all 0.3s ease;
- margin-right: 20px;
- border: 2px solid #006400;
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
- }
-
- .back-button i {
- margin-right: 10px;
- }
-
- .back-button:hover {
- transform: scale(1.05);
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
- }
-
- .config-title {
- font-size: 2rem;
- font-weight: bold;
- color: #00FF00;
- text-shadow: 2px 2px 0 #006400;
- }
-
- .config-content {
- max-width: 600px;
- margin: 0 auto;
- }
-
- .config-section {
- background: linear-gradient(135deg, #98FB98, #90EE90);
- border-radius: 20px;
- padding: 25px;
- margin-bottom: 25px;
- border: 4px solid #228B22;
- box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
- }
-
- .section-title {
- font-size: 1.5rem;
- margin-bottom: 20px;
- color: #00FF00;
- display: flex;
- align-items: center;
- text-shadow: 1px 1px 0 #90EE90;
- border-bottom: 3px solid #228B22;
- padding-bottom: 10px;
- }
-
- .section-title i {
- margin-right: 15px;
- background: #006400;
- width: 40px;
- height: 40px;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- color: #90EE90;
- }
-
- .option-list {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
- gap: 20px;
- }
-
- .option-item {
- display: flex;
- align-items: center;
- padding: 15px;
- background: linear-gradient(90deg, #AFEEEE, #98FB98);
- border-radius: 12px;
- border: 2px solid #228B22;
- }
-
- .option-item input[type="checkbox"] {
- width: 22px;
- height: 22px;
- accent-color: #00FF00;
- margin-right: 12px;
- cursor: pointer;
- }
-
- .option-item label {
- font-size: 16px;
- font-weight: bold;
- color: #006400;
- }
-
- .gold-setting {
- display: flex;
- align-items: center;
- margin: 20px 0;
- padding: 15px;
- background: linear-gradient(90deg, #AFEEEE, #98FB98);
- border-radius: 12px;
- border: 2px solid #228B22;
- }
-
- .gold-setting span {
- margin-right: 20px;
- font-size: 16px;
- font-weight: bold;
- color: #006400;
- }
-
- .radio-group {
- display: flex;
- gap: 20px;
- }
-
- .radio-option {
- display: flex;
- align-items: center;
- }
-
- .radio-option input {
- margin-right: 8px;
- width: 18px;
- height: 18px;
- accent-color: #00FF00;
- }
-
- .radio-option label {
- font-size: 16px;
- font-weight: bold;
- color: #006400;
- }
-
- .input-group {
- display: flex;
- flex-wrap: wrap;
- gap: 20px;
- margin: 20px 0;
- }
-
- .input-field {
- flex: 1;
- min-width: 220px;
- }
-
- .input-field label {
- display: block;
- margin-bottom: 10px;
- font-size: 16px;
- font-weight: bold;
- color: #006400;
- }
-
- .input-field input {
- width: 100%;
- padding: 15px;
- background: linear-gradient(90deg, #AFEEEE, #98FB98);
- border: 2px solid #228B22;
- border-radius: 10px;
- color: #006400;
- font-size: 16px;
- font-weight: bold;
- }
-
- .input-field input::placeholder {
- color: #228B22;
- }
-
- .save-btn {
- background: linear-gradient(90deg, #228B22, #32CD32);
- color: white;
- border: none;
- border-radius: 15px;
- padding: 18px;
- font-size: 18px;
- font-weight: bold;
- cursor: pointer;
- width: 100%;
- margin-top: 25px;
- transition: all 0.3s ease;
- border: 3px solid #006400;
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
- }
-
- .save-btn:hover {
- opacity: 0.9;
- transform: translateY(-3px);
- box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
- }
-
- .note {
- font-size: 14px;
- color: #006400;
- margin-top: 15px;
- text-align: center;
- font-weight: bold;
- }
-
- /* ¶¯»Ð§¹û */
- @keyframes float {
- 0% {
- transform: translateY(0px);
- }
- 50% {
- transform: translateY(-20px);
- }
- 100% {
- transform: translateY(0px);
- }
- }
-
- @keyframes zoomIn {
- from {
- transform: scale(0);
- opacity: 0;
- }
- to {
- transform: scale(1);
- opacity: 1;
- }
- }
-
- .zoom-in {
- animation: zoomIn 0.5s ease forwards;
- }
-
- /* Å©³¡ÔªËØ */
- .farmer-icon {
- position: absolute;
- font-size: 40px;
- color: #006400;
- animation: float 4s ease-in-out infinite;
- }
-
- .farmer-1 {
- top: 20px;
- left: 20px;
- animation-delay: 0s;
- }
-
- .farmer-2 {
- bottom: 20px;
- right: 20px;
- animation-delay: 1s;
- }
-
- @media (max-width: 600px) {
- .start-method {
- flex-direction: column;
- align-items: center;
- gap: 15px;
- }
-
- .option-list {
- grid-template-columns: 1fr;
- }
-
- .input-group {
- flex-direction: column;
- }
- }
- </style>
- </head>
- <body>
- <!-- ×°ÊÎÐÔÅ©³¡Í¼±ê -->
- <div class="farmer-icon farmer-1">
- <i class="fas fa-tractor"></i>
- </div>
- <div class="farmer-icon farmer-2">
- <i class="fas fa-seedling"></i>
- </div>
-
- <!-- Ö÷½çÃæ -->
- <div id="main-container">
- <div class="app-header">
- <h1>ÉÁÖÄÁ³¡Æð·É¼Æ»®</h1>
-
- <div class="gold-nuggets">
- <div class="nugget"></div>
- <div class="nugget"></div>
- <div class="nugget"></div>
- </div>
-
- <div class="start-method">
- <div class="method-option active">
- <div class="method-icon">
- <i class="fas fa-wind"></i>
- </div>
- <span>×ÔÈ»Éú³¤</span>
- </div>
-
- <div class="method-option">
- <div class="method-icon">
- <i class="fas fa-hand-holding-seedling"></i>
- </div>
- <span>ÊÖ¶¯ÖÖÖ²</span>
- </div>
- </div>
- </div>
-
- <div class="app-list">
- <!-- ºì¹û¶Ì¾ç -->
- <div class="app-item">
- <div class="app-checkbox">
- <input type="checkbox" id="app1" checked>
- </div>
- <div class="app-info">
- <div class="app-name">ºì¹û¶Ì¾ç</div>
- <div class="app-duration">¾ÑéÖµÊÕÈë: 120µã/Сʱ</div>
- </div>
- <button class="config-btn" onclick="showConfig('ºì¹û¶Ì¾ç')">ÅäÖÃÖÖÖ²²ÎÊý</button>
- </div>
-
- <!-- ¶¶Òô¼«ËÙ -->
- <div class="app-item">
- <div class="app-checkbox">
- <input type="checkbox" id="app2" checked>
- </div>
- <div class="app-info">
- <div class="app-name">¶¶Òô¼«ËÙ</div>
- <div class="app-duration">¾ÑéÖµÊÕÈë: 150µã/Сʱ</div>
- </div>
- <button class="config-btn" onclick="showConfig('¶¶Òô¼«ËÙ')">ÅäÖÃÖÖÖ²²ÎÊý</button>
- </div>
-
- <!-- ·¬ÇÑС˵ -->
- <div class="app-item">
- <div class="app-checkbox">
- <input type="checkbox" id="app3">
- </div>
- <div class="app-info">
- <div class="app-name">·¬ÇÑС˵</div>
- <div class="app-duration">¾ÑéÖµÊÕÈë: 80µã/Сʱ</div>
- </div>
- <button class="config-btn" onclick="showConfig('·¬ÇÑС˵')">ÅäÖÃÖÖÖ²²ÎÊý</button>
- </div>
-
- <!-- ·¬Çѳ©Ìý -->
- <div class="app-item">
- <div class="app-checkbox">
- <input type="checkbox" id="app4" checked>
- </div>
- <div class="app-info">
- <div class="app-name">·¬Çѳ©Ìý</div>
- <div class="app-duration">¾ÑéÖµÊÕÈë: 200µã/Сʱ</div>
- </div>
- <button class="config-btn" onclick="showConfig('·¬Çѳ©Ìý')">ÅäÖÃÖÖÖ²²ÎÊý</button>
- </div>
-
- <!-- ³©ÌýÒôÀÖ -->
- <div class="app-item">
- <div class="app-checkbox">
- <input type="checkbox" id="app5">
- </div>
- <div class="app-info">
- <div class="app-name">³©ÌýÒôÀÖ</div>
- <div class="app-duration">¾ÑéÖµÊÕÈë: 90µã/Сʱ</div>
- </div>
- <button class="config-btn" onclick="showConfig('³©ÌýÒôÀÖ')">ÅäÖÃÖÖÖ²²ÎÊý</button>
- </div>
-
- <!-- Í·Ìõ¼«ËÙ°æ -->
- <div class="app-item">
- <div class="app-checkbox">
- <input type="checkbox" id="app6">
- </div>
- <div class="app-info">
- <div class="app-name">Í·Ìõ¼«ËÙ°æ</div>
- <div class="app-duration">¾ÑéÖµÊÕÈë: 110µã/Сʱ</div>
- </div>
- <button class="config-btn" onclick="showConfig('Í·Ìõ¼«ËÙ°æ')">ÅäÖÃÖÖÖ²²ÎÊý</button>
- </div>
-
- <!-- Î÷¹ÏÊÓÆµ -->
- <div class="app-item">
- <div class="app-checkbox">
- <input type="checkbox" id="app7" checked>
- </div>
- <div class="app-info">
- <div class="app-name">Î÷¹ÏÊÓÆµ</div>
- <div class="app-duration">¾ÑéÖµÊÕÈë: 180µã/Сʱ</div>
- </div>
- <button class="config-btn" onclick="showConfig('Î÷¹ÏÊÓÆµ')">ÅäÖÃÖÖÖ²²ÎÊý</button>
- </div>
-
- <!-- ÆûË®ÒôÀÖ -->
- <div class="app-item">
- <div class="app-checkbox">
- <input type="checkbox" id="app8">
- </div>
- <div class="app-info">
- <div class="app-name">ÆûË®ÒôÀÖ</div>
- <div class="app-duration">¾ÑéÖµÊÕÈë: 70µã/Сʱ</div>
- </div>
- <button class="config-btn" onclick="showConfig('ÆûË®ÒôÀÖ')">ÅäÖÃÖÖÖ²²ÎÊý</button>
- </div>
- </div>
- </div>
-
- <!-- ÅäÖýçÃæ -->
- <div id="config-page" class="config-page">
- <div class="config-header">
- <button class="back-button" onclick="goBack()">
- <i class="fas fa-arrow-left"></i> ·µ»ØÅ©³¡
- </button>
- <h1 class="config-title">ºì¹û¶Ì¾çÖÖÖ²ÅäÖÃ</h1>
- </div>
-
- <div class="config-content">
- <div class="config-section">
- <h2 class="section-title"><i class="fas fa-cog"></i> ÖÖÖ²¹¦ÄÜÉèÖÃ</h2>
-
- <div class="option-list">
- <div class="option-item">
- <input type="checkbox" id="option1" checked>
- <label for="option1">¹Û¿´¶Ì¾çµÃ¾Ñé</label>
- </div>
-
- <div class="option-item">
- <input type="checkbox" id="option2">
- <label for="option2">²é¿´³É³¤±¨¸æ</label>
- </div>
-
- <div class="option-item">
- <input type="checkbox" id="option3">
- <label for="option3">º£Á¿ÊÓÆµ¹Û¿´</label>
- </div>
-
- <div class="option-item">
- <input type="checkbox" id="option4">
- <label for="option4">ÐÒÔËתÅÌÓÎÏ·</label>
- </div>
-
- <div class="option-item">
- <input type="checkbox" id="option5">
- <label for="option5">·áÊսڻ</label>
- </div>
-
- <div class="option-item">
- <input type="checkbox" id="option6">
- <label for="option6">µ¥¹ã¸æ¹Û¿´</label>
- </div>
-
- <div class="option-item">
- <input type="checkbox" id="option7" checked>
- <label for="option7">¿ªÆô±¦Ïä½±Àø</label>
- </div>
- </div>
- </div>
-
- <div class="config-section">
- <h2 class="section-title"><i class="fas fa-seedling"></i> ¾ÑéÖµ±£»¤ÉèÖÃ</h2>
-
- <div class="gold-setting">
- <span>µ±¾ÑéÖµµÍÓÚ</span>
- <div class="radio-group">
- <div class="radio-option">
- <input type="radio" id="goldOption1" name="goldOption" checked>
- <label for="goldOption1">¼ÌÐøÖÖÖ²</label>
- </div>
- <div class="radio-option">
- <input type="radio" id="goldOption2" name="goldOption">
- <label for="goldOption2">ÔÝÍ£ÖÖÖ²</label>
- </div>
- </div>
- </div>
-
- <div class="input-group">
- <div class="input-field">
- <label>×îµÍ¾ÑéÖµãÐÖµ</label>
- <input type="text" placeholder="2000" value="2000">
- </div>
- </div>
- </div>
-
- <div class="config-section">
- <h2 class="section-title"><i class="fas fa-ad"></i> ¹ã¸æÊ©·ÊÉèÖÃ</h2>
-
- <div class="input-group">
- <div class="input-field">
- <label>Ö±²¥¼äÍ£Áôʱ¼ä£¨Ã룩</label>
- <input type="text" placeholder="5,10" value="5,10">
- </div>
-
- <div class="input-field">
- <label>¹ã¸æ×ª»¯±ÈÀý£¨%£©</label>
- <input type="text" placeholder="50" value="50">
- </div>
-
- <div class="input-field">
- <label>¹ã¸æ×ª»¯Ê±¼ä£¨Ã룩</label>
- <input type="text" placeholder="30,60" value="30,60">
- </div>
-
- <div class="input-field">
- <label>¹ã¸æ¹Ø±Õʱ¼ä£¨Ã룩</label>
- <input type="text" placeholder="8,16" value="8,16">
- </div>
- </div>
-
- <p class="note">ʱ¼äÉèÖÃÇëÓÃÓ¢ÎĶººÅ(,)·Ö¸ô¶à¸öÊýÖµ</p>
- </div>
-
- <button class="save-btn" onclick="saveConfig()">
- <i class="fas fa-save"></i> ±£´æÖÖÖ²ÅäÖò¢·µ»ØÅ©³¡
- </button>
- </div>
- </div>
- <script>
- // ÏÔʾÅäÖýçÃæ
- function showConfig(appName) {
- // ¸üÐÂÅäÖýçÃæ±êÌâ
- document.querySelector('.config-title').textContent = appName + 'ÖÖÖ²ÅäÖÃ';
-
- // Òþ²ØÖ÷½çÃæ
- document.getElementById('main-container').style.display = 'none';
-
- // ÏÔʾÅäÖýçÃæ
- document.getElementById('config-page').classList.add('active');
-
- // Ìí¼Ó¶¯»Ð§¹û
- setTimeout(() => {
- const elements = document.querySelectorAll('.config-section, .save-btn');
- elements.forEach((el, index) => {
- el.style.opacity = '0';
- setTimeout(() => {
- el.classList.add('zoom-in');
- el.style.opacity = '1';
- }, index * 150);
- });
- }, 10);
- }
-
- // ·µ»ØÖ÷½çÃæ
- function goBack() {
- // Òþ²ØÅäÖýçÃæ
- document.getElementById('config-page').classList.remove('active');
-
- // ÏÔʾÖ÷½çÃæ
- setTimeout(() => {
- document.getElementById('main-container').style.display = 'block';
- }, 500);
- }
-
- // ±£´æÅäÖÃ
- function saveConfig() {
- // ÕâÀï¿ÉÒÔÌí¼Ó±£´æÅäÖõÄÂß¼
- alert('ÖÖÖ²ÅäÖÃÒѱ£´æ£¡Å©³¡¼´½«²ú³ö¸ü¶à¹ûʵ£¡');
- goBack();
- }
-
- // Æô¶¯·½Ê½Ñ¡Ôñ
- const methodOptions = document.querySelectorAll('.method-option');
- methodOptions.forEach(option => {
- option.addEventListener('click', () => {
- methodOptions.forEach(opt => opt.classList.remove('active'));
- option.classList.add('active');
- });
- });
-
- // WebView ÓëÔÉú½»»¥µÄº¯Êý
- function setConfig(key, value) {
- // ÔÚʵ¼ÊÓ¦ÓÃÖУ¬Õâ»áµ÷ÓÃÔÉú·½·¨
- console.log('ÉèÖÃÅäÖÃ:', key, '=', value);
- }
-
- function getConfig(key) {
- // ÔÚʵ¼ÊÓ¦ÓÃÖУ¬Õâ»áµ÷ÓÃÔÉú·½·¨²¢·µ»Ø Promise
- return new Promise((resolve) => {
- setTimeout(() => {
- resolve('ÅäÖÃÖµ');
- }, 100);
- });
- }
-
- function toast(message) {
- // ÔÚʵ¼ÊÓ¦ÓÃÖУ¬Õâ»áÏÔʾÔÉú Toast Ìáʾ
- alert(message);
- }
-
- function runJS(callback) {
- // ÔÚʵ¼ÊÓ¦ÓÃÖУ¬Õâ»áÔÚÔÉú»·¾³ÖÐÖ´ÐÐ JS ´úÂë
- callback();
- }
-
- function runFile(filename) {
- // ÔÚʵ¼ÊÓ¦ÓÃÖУ¬Õâ»áÔËÐÐÖ¸¶¨µÄ½Å±¾Îļþ
- console.log('ÔËÐнű¾Îļþ:', filename);
- }
-
- function printl(message) {
- // ÔÚʵ¼ÊÓ¦ÓÃÖУ¬Õâ»á´òÓ¡ÈÕÖ¾
- console.log(message);
- }
- </script>
- </body>
- </html>
- `);
-
- return web;
- }
- // ÑÝʾ WebView µÄ¸÷ÖÖ·½·¨
- function demonstrateWebViewMethods() {
- printl('¿ªÊ¼ÑÝʾ WebView ¿Ø¼þµÄ¸÷ÖÖ·½·¨');
-
- // 1. ´´½¨²¢ÏÔʾ WebView
- var webView = createGreenThemedWebViewExample();
- printl('1. WebView ÒÑ´´½¨²¢ÏÔʾÂÌÉ«Ö÷Ìâ½çÃæ');
-
- // 2. ÑÝʾ loadUrl ·½·¨£¨×¢ÊÍÐÎʽ£¬±ÜÃâʵ¼ÊÌø×ª£©
- // webView.loadUrl('https://www.baidu.com');
- printl('2. loadUrl ·½·¨¿ÉÓÃÓÚ¼ÓÔØÍøÒ³ URL');
-
- // 3. ÑÝʾ loadFile ·½·¨£¨×¢ÊÍÐÎʽ£©
- // webView.loadFile('/sdcard/index.html');
- printl('3. loadFile ·½·¨¿ÉÓÃÓÚ¼ÓÔØ±¾µØÎļþ');
-
- // 4. ÑÝʾ dismiss ·½·¨£¨×¢ÊÍÐÎʽ£¬±ÜÃâʵ¼Ê¹Ø±Õ£©
- // webView.dismiss();
- printl('4. dismiss ·½·¨¿ÉÓÃÓڹرսçÃæ');
-
- printl('WebView ¿Ø¼þ·½·¨ÑÝʾÍê³É');
- }
- // ÔËÐÐʾÀý
- demonstrateWebViewMethods();
¸´ÖÆ´úÂë
|
|