<script>
// 获取民宿信息(占位符)const 民宿信息 = [];// 根据民宿信息生成民宿卡片民宿信息.forEach((民宿) => {const card = document.createElement('div');card.classList.add('card');const img = document.createElement('img');img.src = 民宿.图片;card.appendChild(img);const cardInfo = document.createElement('div');cardInfo.classList.add('card-info');card.appendChild(cardInfo);const cardTitle = document.createElement('h2');cardTitle.classList.add('card-title');cardTitle.textContent = 民宿.名称;cardInfo.appendChild(cardTitle);const cardPrice = document.createElement('p');cardPrice.classList.add('card-price');cardPrice.textContent = `¥${民宿.价格}/晚`;cardInfo.appendChild(cardPrice);const cardAddress = document.createElement('p');cardAddress.classList.add('card-address');cardAddress.textContent = 民宿.地址;cardInfo.appendChild(cardAddress);const cardButton = document.createElement('button');cardButton.classList.add('card-button');cardButton.textContent = '预订';cardInfo.appendChild(cardButton);// 添加到容器中document.querySelector('.container').appendChild(card);
});
script>
郑重声明:本文由:
民宿新闻于(2024-10-15)发表了关于
我附近民宿 (我附近民宿住宿查询)的文章。如转载请注明出处!部分文章来源于网络,仅作为参考,如果网站中图片和文字侵犯了您的版权,请联系我们处理!