AMP-LIST - 在 [src] 更改时更改高度

AMP-LIST - Change Height on [src] Change

Here is the page referred to in this question.

我有一个放大器列表,它根据第一个 selection 从几个 JSON 文件中提取库存数据。 'Select your machine type' 拉动 all.json,'Excavator' 拉动 EX.json,'Wheel Loader' 拉动 WL.json.

在我的 amp-list 中,我使用 PHP 动态设置我的身高 - 我使用的方法从我每晚使用 cronjob 创建的文件中提取我循环的计数变量的最后一个实例。有点不正统,但我在截止日期前,所有 length/count/sizeof 方法都不适合我。

<amp-list width="auto" height="<?php echo file_get_contents('json/count.txt')*70; ?>" [height]="inventory.listSrc.length*70" layout="fixed-height" src="json/all.json" [src]="inventory.listSrc">

当我选择挖掘机时,高度计算正确。当我选择品牌时,身高计算正确。但是,当我选择 Wheel Loader 时,高度计算不正确。虽然,当我 select 制造轮式装载机时,高度计算符合预期。

这是我的两个 JSON 驱动挖掘机和轮式装载机的文件。

EX.json

{"items": [{"SerialNo_SerialNumber":"T15030204","Part_PartNum":"248795-00","Part_PartDescription":"EXM-CWL-120-150-15.50         \r\nCATEX\/312E","Part_CommercialStyle":"EX120","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"312E","RowIdent":"7b057b59-53bb-4687-bc63-fcbfdc2f4f19","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T180400364","Part_PartNum":"16HD200-202011-07120-5","Part_PartDescription":"EXB-HD-542-1.250\/MWL\/200      \rBLK CAT TEETH","Part_CommercialStyle":"EX200","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"EX200","RowIdent":"de867415-7ee4-49c3-9604-4f5e31e604d9","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17010170","Part_PartNum":"216999-00","Part_PartDescription":"EXM-CWL-150-15.50\/DEEREEX\/160D","Part_CommercialStyle":"EX150","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"160D","RowIdent":"c2219e1b-54cf-45cf-b0f5-697d6dd0a404","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15060130","Part_PartNum":"245562-00","Part_PartDescription":"EXM-CWL-150-15.50\/HYUEX\/      \rR160LC-9","Part_CommercialStyle":"EX150","Part_CommercialBrand":"HYUNDAI","Part_CommercialSubBrand":"R160LC-9","RowIdent":"c6dba455-5ec2-448a-b9b6-7fe6dd70eedb","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16060145","Part_PartNum":"245562-00","Part_PartDescription":"EXM-CWL-150-15.50\/HYUEX\/      \rR160LC-9","Part_CommercialStyle":"EX150","Part_CommercialBrand":"HYUNDAI","Part_CommercialSubBrand":"R160LC-9","RowIdent":"6378e33f-f1ee-4c99-b2b9-7f20187b2f76","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T14010014","Part_PartNum":"250184-00","Part_PartDescription":"OBS\/EXM-CWL-080-12.1875       \r\nCATEX\/308D","Part_CommercialStyle":"EX080","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"308D","RowIdent":"7f06f682-4159-482e-a778-3929d10b01e0","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15040238","Part_PartNum":"250070-00","Part_PartDescription":"EXM-CWL-200-18.14\/CASEEX      \r\nCX210C","Part_CommercialStyle":"EX200","Part_CommercialBrand":"CASE","Part_CommercialSubBrand":"CX210C","RowIdent":"c9d12600-c7f8-43c0-83ab-8375a1cd3e01","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16050275           ","Part_PartNum":"248902-00","Part_PartDescription":"EXM-CWL-200-18.14\/CATEX       \r\n320E\"B\" LINKAGE","Part_CommercialStyle":"EX200","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"320E \"B\"","RowIdent":"faaed800-e446-4f34-8392-e4cb1aad1ec0","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16050276           ","Part_PartNum":"248902-00","Part_PartDescription":"EXM-CWL-200-18.14\/CATEX       \r\n320E\"B\" LINKAGE","Part_CommercialStyle":"EX200","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"320E \"B\"","RowIdent":"29af32e1-4fec-4a34-8f56-5b5dcfeb4edd","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T14010006","Part_PartNum":"250019-00","Part_PartDescription":"EXM-CWL-200-18.14\/CATEX\/315D  \r\nTO PICK UP 200 CLASS HOOKS","Part_CommercialStyle":"EX200","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"315D","RowIdent":"e0439609-ab6c-49a6-b7d5-e4a8401cfca4","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T13030022","Part_PartNum":"230677-00","Part_PartDescription":"EXM-CWL-250-18.25\/KOMEX\/PC240L\r\nOFFSET BOSSES","Part_CommercialStyle":"EX250","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC240LC-10","RowIdent":"80a91d28-4bc8-4d32-844e-1823d43ba183","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T14060162","Part_PartNum":"230677-00","Part_PartDescription":"EXM-CWL-250-18.25\/KOMEX\/PC240L\r\nOFFSET BOSSES","Part_CommercialStyle":"EX250","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC240LC-10","RowIdent":"ccbe3dbd-1380-4a28-a1da-7d46e66337fa","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15060138","Part_PartNum":"258593-00","Part_PartDescription":"EXM-CWL-250-18.25\/HYUEX\/R250LC\rOFFSET BOSSES","Part_CommercialStyle":"EX250","Part_CommercialBrand":"HYUNDAI","Part_CommercialSubBrand":"R250LC-7","RowIdent":"65760f26-4f1f-4a44-b4f0-1c0ead59c4ef","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T14010011","Part_PartNum":"250136-00","Part_PartDescription":"172635-00                     \r\n336E \"DB\" LINKAGE","Part_CommercialStyle":"EX300","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"336E \"DB\"","RowIdent":"09e53168-558f-4085-8ee3-b1dfbbdf022e","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T14100335","Part_PartNum":"14CL120-2251501071010","Part_PartDescription":"EXB-CL-054-1.125\/MWL-120-16.25\r\nSTRAIGHT\/3,3,6,6...3,3","Part_CommercialStyle":"EX120","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"EX120","RowIdent":"b5559cb8-7f68-4c65-afc0-367f75223841","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T14100339           ","Part_PartNum":"14CL150-2251501071010","Part_PartDescription":"EXB-CL-054-1.337\/MWL\/150      \r\nSTR. BOE, CRAIG  LOGO","Part_CommercialStyle":"EX150","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"EX150","RowIdent":"d7933a9f-7d05-4556-89af-383d0bd77830","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16030117","Part_PartNum":"16HD300-202011-01090-6","Part_PartDescription":"EXB-HD-654-2.260\/DIR\/HITEX    \r\nMTG ADAPTERS - NO WS","Part_CommercialStyle":"EX300","Part_CommercialBrand":"HITACHI","Part_CommercialSubBrand":"ZX350LC-6","RowIdent":"ccd53bba-80e8-49d5-b5cc-ba85e101063b","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16060243","Part_PartNum":"16SS150-151511-01182-5","Part_PartDescription":"EXB-SS-536-1.000\/DIR\/150      \r\nESCO TEETH, WS INCLD","Part_CommercialStyle":"EX150","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"EX150","RowIdent":"66719efe-fa2f-4efc-a049-3b5376fb50c1","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15040240","Part_PartNum":"255719-50","Part_PartDescription":"EX-CUT-431\/MWL-200-18.14      \r\nFITS 14HD200-2252511071160-5","Part_CommercialStyle":"EX200","Part_CommercialBrand":"HYUNDAI","Part_CommercialSubBrand":"R210-9","RowIdent":"4e14c8b9-631e-41e9-ae96-200963c6531f","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15030088","Part_PartNum":"282974-50","Part_PartDescription":"EX-CUT-426\/DIR\/KOMEX\/PC138    \r\n282815-00","Part_CommercialStyle":"EX120","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC138","RowIdent":"d7d4ea1c-6b48-4d35-be91-497eb7417974","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15030089","Part_PartNum":"282974-50","Part_PartDescription":"EX-CUT-426\/DIR\/KOMEX\/PC138    \r\n282815-00","Part_CommercialStyle":"EX120","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC138","RowIdent":"9c5568d5-0c9d-42db-881c-523dba09f03d","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16050088","Part_PartNum":"283173-50","Part_PartDescription":"EX-CUT-431\/PGKINS\/KOMEX\/      \r\nPC210 - FITS 282656-00","Part_CommercialStyle":"EX200","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC210-10","RowIdent":"540352e4-8a58-4605-9493-8cbc0df79232","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16010137","Part_PartNum":"285657-50","Part_PartDescription":"EX-CUT-431\/PGKINS\/KOMEX       \r\nFITS, 282495-00","Part_CommercialStyle":"EX150","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC170","RowIdent":"018b419b-5cb1-4c30-8243-8d2ed82063aa","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16010134","Part_PartNum":"293724-50","Part_PartDescription":"EX-CUT-425\/DIR\/KOMEX          \r\n16HX150-151511-04182-5","Part_CommercialStyle":"EX150","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC170","RowIdent":"b81a7fe7-d57a-4e64-ac6c-505f1e900fa0","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15120133","Part_PartNum":"310197-00","Part_PartDescription":"EXB-HD-548-1.750\/DIR\/KOMEX    \r\nESCO ULTRA LOCK TEETH","Part_CommercialStyle":"EX250","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC270LC-7","RowIdent":"fcb3aa60-d1f0-4699-ac72-cdb092522af0","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15120149","Part_PartNum":"310306-00","Part_PartDescription":"EXB-HD-542-1.500\/VOLEX        \r\nVOLVO TEETH","Part_CommercialStyle":"EX250","Part_CommercialBrand":"VOLVO","Part_CommercialSubBrand":"EC240C","RowIdent":"632f702c-c70b-4eab-9a91-49cb669a12ea","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16060028","Part_PartNum":"316884-00","Part_PartDescription":"EXB-SS-324-0.620\/EXF-S1       \rVOLEX\/EC210C\/VOL-T","Part_CommercialStyle":"EX200","Part_CommercialBrand":"VOLVO","Part_CommercialSubBrand":"EC210C","RowIdent":"97645f76-e42a-48d4-b58c-fabc25e04332","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16080009","Part_PartNum":"326942-50","Part_PartDescription":"EX-CUT-422\/MWL-120-16.250     \r\nDEEREEX\/130G - 256837-00","Part_CommercialStyle":"EX120","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"EX120","RowIdent":"283596e1-bea0-4c31-b4b0-f57470b771e8","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17010246","Part_PartNum":"337522-00","Part_PartDescription":"EXB-HADC-060-0.75\/WHL-150     \r\n15.50\/STRAIGHT BOE","Part_CommercialStyle":"EX150","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"EX150","RowIdent":"76ee4cbf-7928-47f3-8b11-a0399122d80e","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16050092","Part_PartNum":"14HADC150-611102101","Part_PartDescription":"EXB-HADC-060-0.750\/DIR\/CATEX  \r\nCAT BOE (MILTON)","Part_CommercialStyle":"EX150","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"EX150","RowIdent":"736466b0-3087-4047-af95-c4d366c0a14a","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16050093","Part_PartNum":"14HADC150-611102101","Part_PartDescription":"EXB-HADC-060-0.750\/DIR\/CATEX  \r\nCAT BOE (MILTON)","Part_CommercialStyle":"EX150","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"EX150","RowIdent":"d5984717-fa10-4141-848b-f21771f4c7b8","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T16050094","Part_PartNum":"14HADC150-611102101","Part_PartDescription":"EXB-HADC-060-0.750\/DIR\/CATEX  \r\nCAT BOE (MILTON)","Part_CommercialStyle":"EX150","Part_CommercialBrand":"CAT","Part_CommercialSubBrand":"EX150","RowIdent":"9cfa7f5e-a9b8-4150-8a97-b886d5af35a9","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T15120077","Part_PartNum":"208777-01","Part_PartDescription":"EXB-HADC-XI-066-1.750\/DIR     \r\nDEEREEX\/350G\/3,3,6..6,3,3","Part_CommercialStyle":"EX300","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"350G","RowIdent":"60779f7c-14e7-4653-b3f9-a8a6b6784f1c","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17050014","Part_PartNum":"217018-00","Part_PartDescription":"EXM-CWL-200-18.14\/DEEREEX\/200D","Part_CommercialStyle":"EX200","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"200D","RowIdent":"91dc354d-9320-4f69-b640-862e081d27ef","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17010193","Part_PartNum":"14HADC080-11110811","Part_PartDescription":"EXB-HADC-XI-048-0.500\/MWLXH-80\r\nSTRAIGHT BOE","Part_CommercialStyle":"EX080","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"EX080","RowIdent":"88938c73-0f09-45c5-b101-0c67197fe039","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17100078","Part_PartNum":"174067-50","Part_PartDescription":"EX-CUT-430\/DIR & MWL-200      \rDEEREEX\/200C\/173997 & 169613-0","Part_CommercialStyle":"EX200","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"200C","RowIdent":"37d75288-4d40-4b50-93a1-dd4a07bd2aa9","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17120111","Part_PartNum":"174067-50","Part_PartDescription":"EX-CUT-430\/DIR & MWL-200      \rDEEREEX\/200C\/173997 & 169613-0","Part_CommercialStyle":"EX200","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"200C","RowIdent":"a5b565f6-5bd5-4db5-aa51-0cb48a4750b5","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17100081","Part_PartNum":"312222-00","Part_PartDescription":"EXM-CWL-LH-200-18.14\/DEEREEX  \rC\/W LIFT POINTS (X2)","Part_CommercialStyle":"EX200","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"180G","RowIdent":"276adcb4-2b53-402a-bff5-90eecc1e6cbe","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17120109","Part_PartNum":"312222-00","Part_PartDescription":"EXM-CWL-LH-200-18.14\/DEEREEX  \rC\/W LIFT POINTS (X2)","Part_CommercialStyle":"EX200","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"180G","RowIdent":"8d5fe44f-7f25-4bcf-8c90-d2e26233e427","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17010195","Part_PartNum":"255166-50","Part_PartDescription":"EX-CUT-421\/MWL-080\/DEEREEX\/75D\nFITS: 14HD080-6481511081120-5","Part_CommercialStyle":"EX080","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"75D","RowIdent":"46b3fbb4-3103-46fe-bdf3-8ee6e08a3f0b","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17060170           ","Part_PartNum":"255166-50","Part_PartDescription":"EX-CUT-421\/MWL-080\/DEEREEX\/75D\nFITS: 14HD080-6481511081120-5","Part_CommercialStyle":"EX080","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"75D","RowIdent":"770be696-06de-4a96-b127-dadba836110d","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17060171           ","Part_PartNum":"255166-50","Part_PartDescription":"EX-CUT-421\/MWL-080\/DEEREEX\/75D\nFITS: 14HD080-6481511081120-5","Part_CommercialStyle":"EX080","Part_CommercialBrand":"DEERE","Part_CommercialSubBrand":"75D","RowIdent":"2a899092-983e-4ea2-863e-d2be63f53d1e","Type":"Excavator","FilterName":"EX"},{"SerialNo_SerialNumber":"T17040161","Part_PartNum":"282920-00","Part_PartDescription":"OBS\/EXM-CWL-150-15.50\/KOMEX   \r\nPC170LC-10","Part_CommercialStyle":"EX150","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"PC170LC-10","RowIdent":"a008f295-8953-4c5b-8b4e-396389076ca9","Type":"Excavator","FilterName":"EX"}]}

WL.json

{"items": [{"SerialNo_SerialNumber":"T17090234           ","Part_PartNum":"348170-00","Part_PartDescription":"STRYKER\/12                    \r\nSTD EDGES","Part_CommercialStyle":"WL30","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"WL30","RowIdent":"7d2a279a-7560-41b8-81ba-14fccfadd94b","Type":"Wheel Loader","FilterName":"WL"},{"SerialNo_SerialNumber":"T17100126           ","Part_PartNum":"348170-00","Part_PartDescription":"STRYKER\/12                    \r\nSTD EDGES","Part_CommercialStyle":"WL30","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"WL30","RowIdent":"135c3b28-1954-4314-af6e-1e10c39efde2","Type":"Wheel Loader","FilterName":"WL"},{"SerialNo_SerialNumber":"T17100135           ","Part_PartNum":"348170-00","Part_PartDescription":"STRYKER\/12                    \r\nSTD EDGES","Part_CommercialStyle":"WL30","Part_CommercialBrand":"ANY_MAKE","Part_CommercialSubBrand":"WL30","RowIdent":"aace026a-17bf-4a9e-8e59-10777df425af","Type":"Wheel Loader","FilterName":"WL"},{"SerialNo_SerialNumber":"T17010238","Part_PartNum":"337567-01","Part_PartDescription":"CMP-1.570\/VOL\/VOLL\/L50H       \r\nVOLBOE\/TD\/SEG\/SB\/BT\/88.5","Part_CommercialStyle":"WL20","Part_CommercialBrand":"VOLVO","Part_CommercialSubBrand":"L50H","RowIdent":"284fe2d1-9bc0-4383-8f37-08432140b669","Type":"Wheel Loader","FilterName":"WL"},{"SerialNo_SerialNumber":"T16080156","Part_PartNum":"246675-30","Part_PartDescription":"CVMC\/CASEL-VOL\/721F           \rX-HOSES ONLY","Part_CommercialStyle":"WL50","Part_CommercialBrand":"CASE","Part_CommercialSubBrand":"721F","RowIdent":"5d235e63-04b8-4750-a730-ae6a93b9be7e","Type":"Wheel Loader","FilterName":"WL"},{"SerialNo_SerialNumber":"T16080157","Part_PartNum":"246675-30","Part_PartDescription":"CVMC\/CASEL-VOL\/721F           \rX-HOSES ONLY","Part_CommercialStyle":"WL50","Part_CommercialBrand":"CASE","Part_CommercialSubBrand":"721F","RowIdent":"ab688dad-8eae-4e52-be2e-16e6188f1d13","Type":"Wheel Loader","FilterName":"WL"},{"SerialNo_SerialNumber":"T16090167","Part_PartNum":"264998-30","Part_PartDescription":"CVMC\/KOML-JRB416\/WA270-7      \r\nX-HOSES ONLY","Part_CommercialStyle":"WL30","Part_CommercialBrand":"KOMATSU","Part_CommercialSubBrand":"WA270-7","RowIdent":"7d0be5d4-694b-4044-8df0-c1c1ab24e2f5","Type":"Wheel Loader","FilterName":"WL"}]}

有人想知道轮式装载机为什么不改变高度吗?

看起来是 amp-bind 的一个错误;请参阅 GitHub 上的问题 #10230 and #11251。再看一遍,它也没有在第一个选择的 Excavator 上调整大小,所以它肯定与这个错误有关。 #10230 说我们可能会看到 2018 年 6 月结束修复(希望如此)。