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

home2 게시판 Node.js, Express 게시판 유저가 글을 올렸을때

유저가 글을 올렸을때

9 글 보임 - 11 에서 19 까지 (총 19 중에서)
  • 글쓴이
  • #45178

    유용환
    참가자
    <form id="contact">
                <fieldset>
                  <input placeholder="글 제목" type="text" tabindex="1" @change="userTitle"  required autofocus>
                </fieldset>
                <fieldset>
                  <textarea placeholder="글 내용" tabindex="5" @change="userContent" required></textarea>
                </fieldset>
                <fieldset>
                  <button name="submit" type="submit" id="contact-submit" @click="more">Submit</button>
                </fieldset>
                
              </form>
    
    
    userTitle(e){
          // db.collection('user_post').add({title: e.target.value})
          this.$store.state.user_title = e.target.value
          console.log(this.$store.state.user_title)
        },
        userContent(e){
          // db.collection('user_post').add({content : e.target.value})
          this.$store.state.user_content = e.target.value
          console.log(this.$store.state.user_content)
        },
        more(){
            
            db.collection('user_post').add({title : this.$store.state.user_title ,
            content : this.$store.state.user_content})
            console.log(this.$store.state.user_title, this.$store.state.user_content)
        },   => click 했을때
    이렇게 하면 콘솔창에는 나타나는데 파이어베이스 데이터베이스에는 안올라오는데 확인 해주실수있나요
    (코드 복붙해서요)
    #45217

    codingapple
    키 마스터
    버튼에 type="submit" 없애봅시다
    #45276

    유용환
    참가자
    type="submit"을 없애도 파이어베이스에 안올라오는데 이상하네요
     db.collection('user_post').add({title: e.target.value}) 이런것이 있어야만 같이 올라오고 이것이 없고
    db.collection('user_post').add({title : this.$store.state.user_title ,
            content : this.$store.state.user_content}) 이것만 하면 안올라오는데 이거 버그인가요. (콘솔창에는 잘 나옵니다)
    한번 복붙해서 왜그런지 확인해주실수 있나요
    #45303

    codingapple
    키 마스터
    .add() 뒤에 .then 붙여서 작업완료시의 결과도 출력해봅시다
    #45306

    유용환
    참가자
    then안에 this.$store.state.user_title,  this.$store.state.user_content 콘솔로 출력했는데 잘 나옵니다.
    #45374

    유용환
    참가자
    혹시 이벤트 버블링 때문에 그런건가요
    #45387

    codingapple
    키 마스터
    .add().then((결과)=>{
      console.log(결과)
    })
    그거말고 이거해봅시다
    #45391

    유용환
    참가자
    해보면 
    t {firestore: t, _delegate: t, _userDataWriter: e} 이런것이 나오고 안에 살펴보면 사용자가 입력한 것이 없습니다.
    
    
    #45425

    codingapple
    키 마스터
    뭔가 나오면 저장잘되었다는 소리일걸요 
    input에 타이핑할 때 vuex store에 넣지말고 data에 넣어서 그걸 저장해봅시다
9 글 보임 - 11 에서 19 까지 (총 19 중에서)
  • 답변은 로그인 후 가능합니다.

About

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

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

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