• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 JavaScript, TS 게시판 페이지 여러개만들기 오류

페이지 여러개만들기 오류

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #21356

    열심히
    참가자

        db.collection('product').doc(쿼리스트링.get('id')).get().then((result)=>{
          console.log(result.data())
          $('.title').html(result.data().제목)
          $('.price').html(result.data().가격)
          $('.detail-pic').css('background-image', 'url(${result.data().이미지})' )
        })

     

    이렇게 썼는데 다른것은 다 나오나 이미지가 업로드 되지 않습니다.

    db.collection('product').doc(쿼리스트링.get('id')).get().then((result)=>{
    console.log(result.data())
    var 템플릿 = ` <div class="container">
    상세페이지임
    <div class="detail-pic my-4" style="background-image: url(${result.data().이미지});"></div>
    <div>
    <h5 class="title">${result.data().제목}</h5>
    <p class="date">${result.data().날짜}</p>
    <hr>
    <p class="price">내용 : ${result.data().내용}</p>
    <p class="price">${result.data().가격}원</p>
    <h5>올린사람 : ${JSON.parse(localStorage.getItem('user')).displayName}</h5>
    <button type="submit" class="btn btn-primary" id="edit">수정</button>
    </div>
    </div>`;
    $('.container').append(템플릿)
     

    이렇게 index를 짤때와 같은 방식으로 템플릿에 넣었는데 이미지가 나오긴 하나 뒤에 강의 따라가려니 문제가 생기는거 같아서요 ㅠㅠ

     

    그래서 제가

        db.collection('product').doc(쿼리스트링.get('id')).get().then((result)=>{
          console.log(result.data())
          $('.title').html(result.data().제목)
          $('.price').html(result.data().가격)
          $('.detail-pic').css('background-image', 'url(${result.data().이미지})' )
        })

    이 코드에서 왜 이미지가 업로드 안되는건가요??

    #21391

    codingapple
    키 마스터

    ${변수명} 문법을 쓰고 싶으면 따옴표를 ' 이게 아니라 ` 이거 쓰면 됩니다 

    #21452

    열심히
    참가자

    감사합니다!! ' ` 이게 둘다 작은 따옴푠줄 알았는데 아니였네요 ㅠㅠ

3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠