|
|
AIWROKÈí¼þÆ»¹û½Å±¾°¸Àý1¿Õ°×վλ[Space]·½·¨
- // 🔨🍎UI-¿Õ°×վλ[Space]ÍêÕû×ÛºÏʾÀý
- // ϵͳչʾSpace¿Ø¼þµÄËùÓй¦ÄܺÍʵ¼ÊÓ¦Óó¡¾°
- // ½»Á÷QQȺ711841924
- printl("=== Space¿Ø¼þÍêÕû×ÛºÏʾÀýÆô¶¯ ===");
- // ÏÔʾToastÌáʾ
- function showToast(message) {
- if (typeof toast !== 'undefined') {
- // ¼ì²étoastÊÇ·ñΪº¯Êý
- if (typeof toast === 'function') {
- toast(message);
- } else if (toast && typeof toast.show === 'function') {
- // ¼ÙÉètoastÊÇÒ»¸ö¶ÔÏó£¬ÓÐshow·½·¨
- toast.show(message);
- } else {
- printl("[Toast] " + message);
- }
- } else {
- printl("[Toast] " + message);
- }
- }
- // ÈÕÖ¾¼Ç¼
- function logInteraction(message) {
- printl("[½»»¥] " + message);
- }
- var vc = new IOSView();
- vc.show(function() {
- printl("Space×ÛºÏʾÀý½çÃæÒѼÓÔØ");
-
- // »ñÈ¡µ±Ç°ÊÓͼ
- var view = vc.getView();
-
- // ´´½¨Ö÷ÈÝÆ÷
- var mainContainer = new Vertical();
- mainContainer.setSpacing(15);
- mainContainer.setBackgroundColor(245, 245, 245);
-
- // ±êÌâÇøÓò
- var titleContainer = new Vertical();
- titleContainer.setAlignment("fill");
- titleContainer.setSpacing(5);
- titleContainer.setBackgroundColor(0, 122, 255);
-
- var titleLabel = new Label();
- titleLabel.setText("🔨 Space¿Ø¼þÍêÕû×ÛºÏʾÀý");
- titleLabel.setFontSize(18.0);
- titleLabel.setTextColor(255, 255, 255);
- titleLabel.setTextAlignment("center");
- titleLabel.setWidth(320); // ÉèÖù̶¨¿í¶ÈÒÔÈ·±£±³¾°Ìî³ä
-
- var subtitleLabel = new Label();
- subtitleLabel.setText("¿Õ°×վλ¿Ø¼þµÄÈ«·½Î»Ó¦ÓÃ");
- subtitleLabel.setFontSize(12.0);
- subtitleLabel.setTextColor(255, 255, 255);
- subtitleLabel.setTextAlignment("center");
- subtitleLabel.setWidth(320); // ÉèÖù̶¨¿í¶ÈÒÔÈ·±£±³¾°Ìî³ä
-
- titleContainer.addView(titleLabel);
- titleContainer.addView(subtitleLabel);
- mainContainer.addView(titleContainer);
-
- // SpaceºËÐÄ·½·¨ÑÝÊ¾ÇøÓò
- var coreDemoContainer = new Vertical();
- coreDemoContainer.setBackgroundColor(255, 255, 255);
- coreDemoContainer.setSpacing(15);
-
- var coreTitle = new Label();
- coreTitle.setText("🎯 SpaceºËÐÄ·½·¨ÑÝʾ");
- coreTitle.setFontSize(16.0);
- coreTitle.setTextColor(0, 0, 0);
- coreTitle.setTextAlignment("center");
- coreDemoContainer.addView(coreTitle);
-
- // ·½·¨1£ºsetWidthÉèÖÿí¶È
- var widthDemo = new Vertical();
- widthDemo.setSpacing(8);
-
- var widthLabel = new Label();
- widthLabel.setText("📏 setWidth - ÉèÖÿí¶È");
- widthLabel.setFontSize(14.0);
- widthLabel.setTextColor(0, 122, 255);
- widthDemo.addView(widthLabel);
-
- var widthDesc = new Label();
- widthDesc.setText("´´½¨²»Í¬¿í¶ÈµÄ¿Õ°×ռ룬ÓÃÓÚˮƽ²¼¾Öµ÷Õû");
- widthDesc.setFontSize(12.0);
- widthDesc.setTextColor(100, 100, 100);
- widthDemo.addView(widthDesc);
-
- var widthContainer = new Horizontal();
- widthContainer.setSpacing(5);
- widthContainer.setBackgroundColor(240, 240, 240);
-
- var wLabel1 = new Label();
- wLabel1.setText("×ó");
- wLabel1.setFontSize(12.0);
- wLabel1.setBackgroundColor(0, 122, 255);
- wLabel1.setTextColor(255, 255, 255);
-
- var space1 = new Space();
- space1.setWidth(30.0);
- space1.setBackgroundColor(200, 200, 200);
-
- var wLabel2 = new Label();
- wLabel2.setText("ÖÐ");
- wLabel2.setFontSize(12.0);
- wLabel2.setBackgroundColor(52, 199, 89);
- wLabel2.setTextColor(255, 255, 255);
-
- var space2 = new Space();
- space2.setWidth(60.0);
- space2.setBackgroundColor(200, 200, 200);
-
- var wLabel3 = new Label();
- wLabel3.setText("ÓÒ");
- wLabel3.setFontSize(12.0);
- wLabel3.setBackgroundColor(255, 149, 0);
- wLabel3.setTextColor(255, 255, 255);
-
- widthContainer.addView(wLabel1);
- widthContainer.addView(space1);
- widthContainer.addView(wLabel2);
- widthContainer.addView(space2);
- widthContainer.addView(wLabel3);
- widthDemo.addView(widthContainer);
- coreDemoContainer.addView(widthDemo);
-
- // ·Ö¸îÏß
- var separator1 = new Space();
- separator1.setHeight(10.0);
- coreDemoContainer.addView(separator1);
-
- // ·½·¨2£ºsetHeightÉèÖø߶È
- var heightDemo = new Vertical();
- heightDemo.setSpacing(8);
-
- var heightLabel = new Label();
- heightLabel.setText("📏 setHeight - ÉèÖø߶È");
- heightLabel.setFontSize(14.0);
- heightLabel.setTextColor(0, 122, 255);
- heightDemo.addView(heightLabel);
-
- var heightDesc = new Label();
- heightDesc.setText("´´½¨²»Í¬¸ß¶ÈµÄ¿Õ°×ռ룬ÓÃÓÚ´¹Ö±²¼¾Öµ÷Õû");
- heightDesc.setFontSize(12.0);
- heightDesc.setTextColor(100, 100, 100);
- heightDemo.addView(heightDesc);
-
- var heightContainer = new Vertical();
- heightContainer.setBackgroundColor(240, 240, 240);
-
- var hLabel1 = new Label();
- hLabel1.setText("ÉÏ");
- hLabel1.setFontSize(12.0);
- hLabel1.setBackgroundColor(0, 122, 255);
- hLabel1.setTextColor(255, 255, 255);
- hLabel1.setTextAlignment("center");
-
- var space3 = new Space();
- space3.setHeight(20.0);
- space3.setBackgroundColor(200, 200, 200);
-
- var hLabel2 = new Label();
- hLabel2.setText("ÖÐ");
- hLabel2.setFontSize(12.0);
- hLabel2.setBackgroundColor(52, 199, 89);
- hLabel2.setTextColor(255, 255, 255);
- hLabel2.setTextAlignment("center");
-
- var space4 = new Space();
- space4.setHeight(40.0);
- space4.setBackgroundColor(200, 200, 200);
-
- var hLabel3 = new Label();
- hLabel3.setText("ÏÂ");
- hLabel3.setFontSize(12.0);
- hLabel3.setBackgroundColor(255, 149, 0);
- hLabel3.setTextColor(255, 255, 255);
- hLabel3.setTextAlignment("center");
-
- heightContainer.addView(hLabel1);
- heightContainer.addView(space3);
- heightContainer.addView(hLabel2);
- heightContainer.addView(space4);
- heightContainer.addView(hLabel3);
- heightDemo.addView(heightContainer);
- coreDemoContainer.addView(heightDemo);
-
- // ·Ö¸îÏß
- var separator2 = new Space();
- separator2.setHeight(10.0);
- coreDemoContainer.addView(separator2);
-
- // ·½·¨3£ºsetBackgroundColorÉèÖñ³¾°ÑÕÉ«
- var colorDemo = new Vertical();
- colorDemo.setSpacing(8);
-
- var colorLabel = new Label();
- colorLabel.setText("🎨 setBackgroundColor - ÉèÖñ³¾°ÑÕÉ«");
- colorLabel.setFontSize(14.0);
- colorLabel.setTextColor(0, 122, 255);
- colorDemo.addView(colorLabel);
-
- var colorDesc = new Label();
- colorDesc.setText("Ϊ¿Õ°×ռλÉèÖñ³¾°ÑÕÉ«£¬ÓÃÓÚÊÓ¾õ·Ö¸ô»ò×°ÊÎ");
- colorDesc.setFontSize(12.0);
- colorDesc.setTextColor(100, 100, 100);
- colorDemo.addView(colorDesc);
-
- var colorContainer = new Horizontal();
- colorContainer.setSpacing(10);
-
- var space5 = new Space();
- space5.setWidth(50.0);
- space5.setHeight(50.0);
- space5.setBackgroundColor(255, 0, 0);
-
- var space6 = new Space();
- space6.setWidth(50.0);
- space6.setHeight(50.0);
- space6.setBackgroundColor(0, 255, 0);
-
- var space7 = new Space();
- space7.setWidth(50.0);
- space7.setHeight(50.0);
- space7.setBackgroundColor(0, 0, 255);
-
- var space8 = new Space();
- space8.setWidth(50.0);
- space8.setHeight(50.0);
- space8.setBackgroundColor(255, 255, 0);
-
- colorContainer.addView(space5);
- colorContainer.addView(space6);
- colorContainer.addView(space7);
- colorContainer.addView(space8);
- colorDemo.addView(colorContainer);
- coreDemoContainer.addView(colorDemo);
-
- mainContainer.addView(coreDemoContainer);
-
- // ʵ¼ÊÓ¦Óó¡¾°
- var applicationContainer = new Vertical();
- applicationContainer.setBackgroundColor(255, 255, 255);
- applicationContainer.setSpacing(15);
-
- var appTitle = new Label();
- appTitle.setText("💼 Spaceʵ¼ÊÓ¦Óó¡¾°");
- appTitle.setFontSize(16.0);
- appTitle.setTextColor(0, 0, 0);
- appTitle.setTextAlignment("center");
- applicationContainer.addView(appTitle);
-
- // ³¡¾°1£º±íµ¥²¼¾Ö
- var formContainer = new Vertical();
- formContainer.setSpacing(10);
-
- var formTitle = new Label();
- formTitle.setText("📋 ±íµ¥²¼¾ÖʾÀý");
- formTitle.setFontSize(14.0);
- formTitle.setTextColor(0, 122, 255);
- formContainer.addView(formTitle);
-
- // ÐÕÃûÊäÈëÐÐ
- var nameRow = new Horizontal();
- nameRow.setSpacing(10);
-
- var nameLabel = new Label();
- nameLabel.setText("ÐÕÃû:");
- nameLabel.setWidth(60);
- nameLabel.setTextColor(0, 0, 0);
-
- var nameInput = new Label();
- nameInput.setText("ÇëÊäÈëÐÕÃû");
- nameInput.setBackgroundColor(240, 240, 240);
-
- nameRow.addView(nameLabel);
- nameRow.addView(nameInput);
- formContainer.addView(nameRow);
-
- // ´¹Ö±¼ä¾à
- var formSpace1 = new Space();
- formSpace1.setHeight(10.0);
- formContainer.addView(formSpace1);
-
- // ÄêÁäÊäÈëÐÐ
- var ageRow = new Horizontal();
- ageRow.setSpacing(10);
-
- var ageLabel = new Label();
- ageLabel.setText("ÄêÁä:");
- ageLabel.setWidth(60);
- ageLabel.setTextColor(0, 0, 0);
-
- var ageInput = new Label();
- ageInput.setText("ÇëÊäÈëÄêÁä");
- ageInput.setBackgroundColor(240, 240, 240);
-
- ageRow.addView(ageLabel);
- ageRow.addView(ageInput);
- formContainer.addView(ageRow);
-
- // ´¹Ö±¼ä¾à
- var formSpace2 = new Space();
- formSpace2.setHeight(10.0);
- formContainer.addView(formSpace2);
-
- // ÓÊÏäÊäÈëÐÐ
- var emailRow = new Horizontal();
- emailRow.setSpacing(10);
-
- var emailLabel = new Label();
- emailLabel.setText("ÓÊÏä:");
- emailLabel.setWidth(60);
- emailLabel.setTextColor(0, 0, 0);
-
- var emailInput = new Label();
- emailInput.setText("ÇëÊäÈëÓÊÏä");
- emailInput.setBackgroundColor(240, 240, 240);
-
- emailRow.addView(emailLabel);
- emailRow.addView(emailInput);
- formContainer.addView(emailRow);
-
- applicationContainer.addView(formContainer);
-
- // ³¡¾°2£º¿¨Æ¬²¼¾Ö
- var cardContainer = new Vertical();
- cardContainer.setSpacing(10);
-
- var cardTitle = new Label();
- cardTitle.setText("📄 ¿¨Æ¬²¼¾ÖʾÀý");
- cardTitle.setFontSize(14.0);
- cardTitle.setTextColor(0, 122, 255);
- cardContainer.addView(cardTitle);
-
- var card = new Vertical();
- card.setBackgroundColor(255, 255, 255);
- card.setSpacing(10);
-
- var cardHeader = new Horizontal();
- cardHeader.setSpacing(10);
-
- var cardIcon = new Label();
- cardIcon.setText("📱");
- cardIcon.setFontSize(24.0);
-
- var cardInfo = new Vertical();
- cardInfo.setSpacing(2);
-
- var cardName = new Label();
- cardName.setText("²úÆ·Ãû³Æ");
- cardName.setFontSize(16.0);
- cardName.setTextColor(0, 0, 0);
-
- var cardDesc = new Label();
- cardDesc.setText("ÕâÊÇÒ»¸ö²úÆ·ÃèÊö");
- cardDesc.setFontSize(12.0);
- cardDesc.setTextColor(100, 100, 100);
-
- cardInfo.addView(cardName);
- cardInfo.addView(cardDesc);
- cardHeader.addView(cardIcon);
- cardHeader.addView(cardInfo);
- card.addView(cardHeader);
-
- // ¿¨Æ¬ÄÚÈÝ
- var cardContent = new Label();
- cardContent.setText("¿¨Æ¬ÄÚÈÝÇøÓò£¬Õ¹Ê¾ÏêϸÐÅÏ¢...");
- cardContent.setFontSize(14.0);
- cardContent.setTextColor(50, 50, 50);
- card.addView(cardContent);
-
- // ¿¨Æ¬µ×²¿
- var cardFooter = new Horizontal();
- cardFooter.setSpacing(10);
-
- var priceLabel = new Label();
- priceLabel.setText("¥99.00");
- priceLabel.setFontSize(16.0);
- priceLabel.setTextColor(255, 59, 48);
-
- var buyButton = new Button();
- buyButton.setText("¹ºÂò");
- buyButton.setColor(0, 122, 255);
- buyButton.setTextColor(255, 255, 255);
- buyButton.setWidth(80);
- buyButton.setHeight(30);
-
- // ʹÓÃSpace´´½¨¼ä¾à
- var footerSpace = new Space();
-
- cardFooter.addView(priceLabel);
- cardFooter.addView(footerSpace);
- cardFooter.addView(buyButton);
- card.addView(cardFooter);
-
- cardContainer.addView(card);
- applicationContainer.addView(cardContainer);
-
- // ³¡¾°3£ºµ¼º½À¸²¼¾Ö
- var navContainer = new Vertical();
- navContainer.setSpacing(10);
-
- var navTitle = new Label();
- navTitle.setText("🧭 µ¼º½À¸²¼¾ÖʾÀý");
- navTitle.setFontSize(14.0);
- navTitle.setTextColor(0, 122, 255);
- navContainer.addView(navTitle);
-
- var navBar = new Horizontal();
- navBar.setSpacing(10);
- navBar.setBackgroundColor(240, 240, 240);
-
- var backButton = new Button();
- backButton.setText("·µ»Ø");
- backButton.setColor(0, 122, 255);
- backButton.setTextColor(255, 255, 255);
- backButton.setWidth(80);
- backButton.setHeight(30);
-
- var navSpace = new Space();
-
- var titleButton = new Button();
- titleButton.setText("Ê×Ò³");
- titleButton.setColor(52, 199, 89);
- titleButton.setTextColor(255, 255, 255);
- titleButton.setWidth(80);
- titleButton.setHeight(30);
-
- var menuButton = new Button();
- menuButton.setText("²Ëµ¥");
- menuButton.setColor(255, 149, 0);
- menuButton.setTextColor(255, 255, 255);
- menuButton.setWidth(80);
- menuButton.setHeight(30);
-
- navBar.addView(backButton);
- navBar.addView(navSpace);
- navBar.addView(titleButton);
- navBar.addView(menuButton);
- navContainer.addView(navBar);
- applicationContainer.addView(navContainer);
-
- mainContainer.addView(applicationContainer);
-
- // ½»»¥¹¦ÄÜÑÝʾ
- var interactionContainer = new Vertical();
- interactionContainer.setBackgroundColor(236, 245, 255);
- interactionContainer.setSpacing(15);
-
- var interactionTitle = new Label();
- interactionTitle.setText("🔄 ½»»¥¹¦ÄÜÑÝʾ");
- interactionTitle.setFontSize(16.0);
- interactionTitle.setTextColor(0, 122, 255);
- interactionContainer.addView(interactionTitle);
-
- var interactionDesc = new Label();
- interactionDesc.setText("µã»÷Ï·½°´Å¥ÌåÑéSpace¿Ø¼þµÄ¶¯Ì¬Ð§¹û");
- interactionDesc.setFontSize(12.0);
- interactionDesc.setTextColor(100, 100, 100);
- interactionContainer.addView(interactionDesc);
-
- var dynamicContainer = new Vertical();
- dynamicContainer.setSpacing(10);
-
- var dynamicSpace = new Space();
- dynamicSpace.setHeight(50.0);
- dynamicSpace.setBackgroundColor(200, 200, 200);
- dynamicContainer.addView(dynamicSpace);
-
- var controlButtons = new Horizontal();
- controlButtons.setSpacing(10);
- controlButtons.setAlignment("center");
-
- var increaseButton = new Button();
- increaseButton.setText("Ôö¼Ó¸ß¶È");
- increaseButton.setColor(0, 122, 255);
- increaseButton.setTextColor(255, 255, 255);
- increaseButton.setWidth(100);
- increaseButton.setHeight(35);
-
- var decreaseButton = new Button();
- decreaseButton.setText("¼õÉٸ߶È");
- decreaseButton.setColor(255, 59, 48);
- decreaseButton.setTextColor(255, 255, 255);
- decreaseButton.setWidth(100);
- decreaseButton.setHeight(35);
-
- var changeColorButton = new Button();
- changeColorButton.setText("¸Ä±äÑÕÉ«");
- changeColorButton.setColor(52, 199, 89);
- changeColorButton.setTextColor(255, 255, 255);
- changeColorButton.setWidth(100);
- changeColorButton.setHeight(35);
-
- controlButtons.addView(increaseButton);
- controlButtons.addView(decreaseButton);
- controlButtons.addView(changeColorButton);
- dynamicContainer.addView(controlButtons);
- interactionContainer.addView(dynamicContainer);
- mainContainer.addView(interactionContainer);
-
- // ¿Ø¼þÐÅÏ¢ÇøÓò
- var infoContainer = new Vertical();
- infoContainer.setBackgroundColor(255, 255, 255);
- infoContainer.setSpacing(8);
-
- var infoTitle = new Label();
- infoTitle.setText("ℹ️ Space¿Ø¼þ˵Ã÷");
- infoTitle.setFontSize(16.0);
- infoTitle.setTextColor(0, 122, 255);
- infoContainer.addView(infoTitle);
-
- var info1 = new Label();
- info1.setText("• Space¿Ø¼þÓÃÓÚ´´½¨¿Õ°×Õ¼Î»ÇøÓò");
- info1.setFontSize(12.0);
- info1.setTextColor(52, 58, 64);
- infoContainer.addView(info1);
-
- var info2 = new Label();
- info2.setText("• ºËÐÄ·½·¨£ºsetWidth()¡¢setHeight()¡¢setBackgroundColor()");
- info2.setFontSize(12.0);
- info2.setTextColor(52, 58, 64);
- infoContainer.addView(info2);
-
- var info3 = new Label();
- info3.setText("• Ó¦Óó¡¾°£º²¼¾Ö¼ä¾à¡¢ÊÓ¾õ·Ö¸ô¡¢ÏìӦʽ²¼¾Ö");
- info3.setFontSize(12.0);
- info3.setTextColor(52, 58, 64);
- infoContainer.addView(info3);
-
- var info4 = new Label();
- info4.setText("• ÓÅÊÆ£ºÇáÁ¿¼¶¡¢Áé»î¡¢²»Õ¼ÓÃϵͳ×ÊÔ´");
- info4.setFontSize(12.0);
- info4.setTextColor(52, 58, 64);
- infoContainer.addView(info4);
-
- mainContainer.addView(infoContainer);
-
- // µ×²¿²Ù×÷°´Å¥
- var bottomContainer = new Horizontal();
- bottomContainer.setSpacing(10);
- bottomContainer.setAlignment("center");
-
- var saveButton = new Button();
- saveButton.setText("±£´æÊ¾Àý");
- saveButton.setColor(52, 199, 89);
- saveButton.setTextColor(255, 255, 255);
- saveButton.setHeight(40);
-
- var resetButton = new Button();
- resetButton.setText("ÖØÖÃʾÀý");
- resetButton.setColor(255, 149, 0);
- resetButton.setTextColor(255, 255, 255);
- resetButton.setHeight(40);
-
- var exitButton = new Button();
- exitButton.setText("Í˳öʾÀý");
- exitButton.setColor(255, 59, 48);
- exitButton.setTextColor(255, 255, 255);
- exitButton.setHeight(40);
-
- bottomContainer.addView(saveButton);
- bottomContainer.addView(resetButton);
- bottomContainer.addView(exitButton);
- mainContainer.addView(bottomContainer);
-
- // Ìí¼Óµ½Ö÷ÊÓͼ
- view.addView(mainContainer);
-
- printl("Space×ÛºÏʾÀý½çÃæ¹¹½¨Íê³É");
-
- // °ó¶¨Ê¼þ´¦Àí
- // ±íµ¥ÊäÈëµã»÷ʼþ - ×¢Ê͵ôLabelµÄonClickʼþ£¬ÒòΪLabel¿ÉÄܲ»Ö§³Ö´Ë·½·¨
- /*
- nameInput.onClick(function() {
- nameInput.setText("ÕÅÈý");
- nameInput.setBackgroundColor(200, 230, 255);
- showToast("ÐÕÃûÒÑ×Ô¶¯Ìî³ä");
- logInteraction("µã»÷ÁËÐÕÃûÊäÈë¿ò£¬×Ô¶¯Ìî³äΪ'ÕÅÈý'");
- });
-
- ageInput.onClick(function() {
- ageInput.setText("25");
- ageInput.setBackgroundColor(200, 230, 255);
- showToast("ÄêÁäÒÑ×Ô¶¯Ìî³ä");
- logInteraction("µã»÷ÁËÄêÁäÊäÈë¿ò£¬×Ô¶¯Ìî³äΪ'25'");
- });
-
- emailInput.onClick(function() {
- emailInput.setText("zhangsan@example.com");
- emailInput.setBackgroundColor(200, 230, 255);
- showToast("ÓÊÏäÒÑ×Ô¶¯Ìî³ä");
- logInteraction("µã»÷ÁËÓÊÏäÊäÈë¿ò£¬×Ô¶¯Ìî³äΪ'zhangsan@example.com'");
- });
- */
-
- // ¿¨Æ¬¹ºÂò°´Å¥µã»÷ʼþ
- buyButton.onClick(function() {
- showToast("¹ºÂò³É¹¦£¡");
- logInteraction("µã»÷Á˹ºÂò°´Å¥");
- });
-
- // µ¼º½À¸°´Å¥µã»÷ʼþ
- backButton.onClick(function() {
- showToast("·µ»ØÉÏÒ»Ò³");
- logInteraction("µã»÷ÁË·µ»Ø°´Å¥");
- });
-
- titleButton.onClick(function() {
- showToast("Ìø×ªµ½Ê×Ò³");
- logInteraction("µã»÷ÁËÊ×Ò³°´Å¥");
- });
-
- menuButton.onClick(function() {
- showToast("´ò¿ª²Ëµ¥");
- logInteraction("µã»÷Á˲˵¥°´Å¥");
- });
-
- // ¶¯Ì¬Ð§¹û°´Å¥µã»÷ʼþ
- var currentHeight = 50;
- increaseButton.onClick(function() {
- currentHeight += 20;
- dynamicSpace.setHeight(currentHeight);
- showToast("Space¸ß¶ÈÔö¼Óµ½£º" + currentHeight + "px");
- logInteraction("µã»÷ÁËÔö¼Ó¸ß¶È°´Å¥£¬µ±Ç°¸ß¶È£º" + currentHeight + "px");
- });
-
- decreaseButton.onClick(function() {
- if (currentHeight > 20) {
- currentHeight -= 20;
- dynamicSpace.setHeight(currentHeight);
- showToast("Space¸ß¶È¼õÉÙµ½£º" + currentHeight + "px");
- logInteraction("µã»÷Á˼õÉٸ߶Ȱ´Å¥£¬µ±Ç°¸ß¶È£º" + currentHeight + "px");
- } else {
- showToast("¸ß¶ÈÒÑ´ïµ½×îСֵ");
- logInteraction("µã»÷Á˼õÉٸ߶Ȱ´Å¥£¬ÒÑ´ïµ½×îСֵ");
- }
- });
-
- var colors = [[255, 0, 0], [0, 255, 0], [0, 0, 255], [255, 255, 0], [255, 0, 255], [0, 255, 255]];
- var colorIndex = 0;
- changeColorButton.onClick(function() {
- colorIndex = (colorIndex + 1) % colors.length;
- var color = colors[colorIndex];
- dynamicSpace.setBackgroundColor(color[0], color[1], color[2]);
- showToast("SpaceÑÕÉ«ÒѸıä");
- logInteraction("µã»÷Á˸ıäÑÕÉ«°´Å¥£¬µ±Ç°ÑÕÉ«£ºRGB(" + color[0] + "," + color[1] + "," + color[2] + ")");
- });
-
- // µ×²¿°´Å¥µã»÷ʼþ
- saveButton.onClick(function() {
- showToast("ʾÀýÒѱ£´æ");
- logInteraction("µã»÷Á˱£´æÊ¾Àý°´Å¥");
- });
-
- resetButton.onClick(function() {
- // ÖØÖÃ±íµ¥
- nameInput.setText("ÇëÊäÈëÐÕÃû");
- nameInput.setBackgroundColor(240, 240, 240);
- ageInput.setText("ÇëÊäÈëÄêÁä");
- ageInput.setBackgroundColor(240, 240, 240);
- emailInput.setText("ÇëÊäÈëÓÊÏä");
- emailInput.setBackgroundColor(240, 240, 240);
-
- // ÖØÖö¯Ì¬Space
- currentHeight = 50;
- dynamicSpace.setHeight(currentHeight);
- dynamicSpace.setBackgroundColor(200, 200, 200);
- colorIndex = 0;
-
- showToast("ʾÀýÒÑÖØÖÃ");
- logInteraction("µã»÷ÁËÖØÖÃʾÀý°´Å¥");
- });
-
- exitButton.onClick(function() {
- showToast("Í˳öʾÀý");
- logInteraction("µã»÷ÁËÍ˳öʾÀý°´Å¥");
- vc.dismiss();
- });
- });
- printl("Space¿Ø¼þÍêÕû×ÛºÏʾÀýÒÑÆô¶¯");
¸´ÖÆ´úÂë
|
|