vue-slick slider not works for my components and appearance gets ruined












0















at first, sorry for my bad english.
i'm using vue-slick in my vuejs code,
i had a problem with its style!
when i use a simple div or img or smth , it works great!
but when i use a v-for for my component in it, the style Appearance gets ruined!



i'm using event bus to handle data.
i've already imported slick-carousel style and theme css in my styles.
here you a screenshot from my problem
https://ibb.co/4RgL1nG
https://www.mediafire.com/view/oui50d2e4057wq7/Screenshot_from_2019-01-02_11-12-19.png



 <template>
<div>
<div class="container" style="padding: 0 40px; height: 400px;
background-color: #1b1e21">
<slick
ref="slick" style="max-width: 100% ; "
:options=this.slickOptions>
<div v-for="pst in posts">
<div class="council-subject-content-item color 1"
@click="openPost(pst._id, pst.authorId)">
<div class="title-image"></div>
<h4 class="black-color">{{pst.title}}</h4>
<h5>{{pst.superParentName}}</h5>
<p class="black-color">
{{pst.content[0].text}}{{pst.content[0].text}}
</p>
<div class="profile-image"></div>
<span class="name regular-ir">{{pst.authorName}}
</span>
<div class="council-subject-footer background-1">
<span class="right number">{{pst.commentNum}}</span>
<img class="right"
src="../../images/consultation/comment2.svg" style="width: 20px">
<img class="left"
src="../../images/consultation/viewed.svg" style="width:
24px;margin-top: 2px;">
<span class="left number">{{pst.seenNum}}</span>
</div>
</div>
</div>
</slick>
</div>
</div>
</template>

<script>
import slick from 'vue-slick'
import {eventBus} from "../../main";
import axios from 'axios'

export default {
data: function () {
return {
posts: {},
slickOptions: {
slidesToShow: 4,
centerMode: true,
dots: true,
arrows: true,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: true,
dots: true
}
},
{
breakpoint: 600,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
}
}
},
beforeMount() {

axios.get('https://www.test.magisterapp.ir/v2/student/post/all/1-5?sortby=seenNum')
.then(res => {
this.posts = res.data.posts
})
.catch(error => {
console.log(error)
})
},
methods: {
createRandClass() {
let color = math.floor((Math.random() * 4) + 1);
return "color" + color
},
openPost(id, teacherId) {
console.log(id)
this.$router.push({
name: "blogPost",
query: {
"id": id
},
params: {
"teacherId": teacherId
}
})
}
},
components: {
slick
}

}
</script>









share|improve this question



























    0















    at first, sorry for my bad english.
    i'm using vue-slick in my vuejs code,
    i had a problem with its style!
    when i use a simple div or img or smth , it works great!
    but when i use a v-for for my component in it, the style Appearance gets ruined!



    i'm using event bus to handle data.
    i've already imported slick-carousel style and theme css in my styles.
    here you a screenshot from my problem
    https://ibb.co/4RgL1nG
    https://www.mediafire.com/view/oui50d2e4057wq7/Screenshot_from_2019-01-02_11-12-19.png



     <template>
    <div>
    <div class="container" style="padding: 0 40px; height: 400px;
    background-color: #1b1e21">
    <slick
    ref="slick" style="max-width: 100% ; "
    :options=this.slickOptions>
    <div v-for="pst in posts">
    <div class="council-subject-content-item color 1"
    @click="openPost(pst._id, pst.authorId)">
    <div class="title-image"></div>
    <h4 class="black-color">{{pst.title}}</h4>
    <h5>{{pst.superParentName}}</h5>
    <p class="black-color">
    {{pst.content[0].text}}{{pst.content[0].text}}
    </p>
    <div class="profile-image"></div>
    <span class="name regular-ir">{{pst.authorName}}
    </span>
    <div class="council-subject-footer background-1">
    <span class="right number">{{pst.commentNum}}</span>
    <img class="right"
    src="../../images/consultation/comment2.svg" style="width: 20px">
    <img class="left"
    src="../../images/consultation/viewed.svg" style="width:
    24px;margin-top: 2px;">
    <span class="left number">{{pst.seenNum}}</span>
    </div>
    </div>
    </div>
    </slick>
    </div>
    </div>
    </template>

    <script>
    import slick from 'vue-slick'
    import {eventBus} from "../../main";
    import axios from 'axios'

    export default {
    data: function () {
    return {
    posts: {},
    slickOptions: {
    slidesToShow: 4,
    centerMode: true,
    dots: true,
    arrows: true,
    responsive: [
    {
    breakpoint: 1024,
    settings: {
    slidesToShow: 3,
    slidesToScroll: 3,
    infinite: true,
    dots: true
    }
    },
    {
    breakpoint: 600,
    settings: {
    slidesToShow: 2,
    slidesToScroll: 2
    }
    },
    {
    breakpoint: 480,
    settings: {
    slidesToShow: 1,
    slidesToScroll: 1
    }
    }
    ]
    }
    }
    },
    beforeMount() {

    axios.get('https://www.test.magisterapp.ir/v2/student/post/all/1-5?sortby=seenNum')
    .then(res => {
    this.posts = res.data.posts
    })
    .catch(error => {
    console.log(error)
    })
    },
    methods: {
    createRandClass() {
    let color = math.floor((Math.random() * 4) + 1);
    return "color" + color
    },
    openPost(id, teacherId) {
    console.log(id)
    this.$router.push({
    name: "blogPost",
    query: {
    "id": id
    },
    params: {
    "teacherId": teacherId
    }
    })
    }
    },
    components: {
    slick
    }

    }
    </script>









    share|improve this question

























      0












      0








      0








      at first, sorry for my bad english.
      i'm using vue-slick in my vuejs code,
      i had a problem with its style!
      when i use a simple div or img or smth , it works great!
      but when i use a v-for for my component in it, the style Appearance gets ruined!



      i'm using event bus to handle data.
      i've already imported slick-carousel style and theme css in my styles.
      here you a screenshot from my problem
      https://ibb.co/4RgL1nG
      https://www.mediafire.com/view/oui50d2e4057wq7/Screenshot_from_2019-01-02_11-12-19.png



       <template>
      <div>
      <div class="container" style="padding: 0 40px; height: 400px;
      background-color: #1b1e21">
      <slick
      ref="slick" style="max-width: 100% ; "
      :options=this.slickOptions>
      <div v-for="pst in posts">
      <div class="council-subject-content-item color 1"
      @click="openPost(pst._id, pst.authorId)">
      <div class="title-image"></div>
      <h4 class="black-color">{{pst.title}}</h4>
      <h5>{{pst.superParentName}}</h5>
      <p class="black-color">
      {{pst.content[0].text}}{{pst.content[0].text}}
      </p>
      <div class="profile-image"></div>
      <span class="name regular-ir">{{pst.authorName}}
      </span>
      <div class="council-subject-footer background-1">
      <span class="right number">{{pst.commentNum}}</span>
      <img class="right"
      src="../../images/consultation/comment2.svg" style="width: 20px">
      <img class="left"
      src="../../images/consultation/viewed.svg" style="width:
      24px;margin-top: 2px;">
      <span class="left number">{{pst.seenNum}}</span>
      </div>
      </div>
      </div>
      </slick>
      </div>
      </div>
      </template>

      <script>
      import slick from 'vue-slick'
      import {eventBus} from "../../main";
      import axios from 'axios'

      export default {
      data: function () {
      return {
      posts: {},
      slickOptions: {
      slidesToShow: 4,
      centerMode: true,
      dots: true,
      arrows: true,
      responsive: [
      {
      breakpoint: 1024,
      settings: {
      slidesToShow: 3,
      slidesToScroll: 3,
      infinite: true,
      dots: true
      }
      },
      {
      breakpoint: 600,
      settings: {
      slidesToShow: 2,
      slidesToScroll: 2
      }
      },
      {
      breakpoint: 480,
      settings: {
      slidesToShow: 1,
      slidesToScroll: 1
      }
      }
      ]
      }
      }
      },
      beforeMount() {

      axios.get('https://www.test.magisterapp.ir/v2/student/post/all/1-5?sortby=seenNum')
      .then(res => {
      this.posts = res.data.posts
      })
      .catch(error => {
      console.log(error)
      })
      },
      methods: {
      createRandClass() {
      let color = math.floor((Math.random() * 4) + 1);
      return "color" + color
      },
      openPost(id, teacherId) {
      console.log(id)
      this.$router.push({
      name: "blogPost",
      query: {
      "id": id
      },
      params: {
      "teacherId": teacherId
      }
      })
      }
      },
      components: {
      slick
      }

      }
      </script>









      share|improve this question














      at first, sorry for my bad english.
      i'm using vue-slick in my vuejs code,
      i had a problem with its style!
      when i use a simple div or img or smth , it works great!
      but when i use a v-for for my component in it, the style Appearance gets ruined!



      i'm using event bus to handle data.
      i've already imported slick-carousel style and theme css in my styles.
      here you a screenshot from my problem
      https://ibb.co/4RgL1nG
      https://www.mediafire.com/view/oui50d2e4057wq7/Screenshot_from_2019-01-02_11-12-19.png



       <template>
      <div>
      <div class="container" style="padding: 0 40px; height: 400px;
      background-color: #1b1e21">
      <slick
      ref="slick" style="max-width: 100% ; "
      :options=this.slickOptions>
      <div v-for="pst in posts">
      <div class="council-subject-content-item color 1"
      @click="openPost(pst._id, pst.authorId)">
      <div class="title-image"></div>
      <h4 class="black-color">{{pst.title}}</h4>
      <h5>{{pst.superParentName}}</h5>
      <p class="black-color">
      {{pst.content[0].text}}{{pst.content[0].text}}
      </p>
      <div class="profile-image"></div>
      <span class="name regular-ir">{{pst.authorName}}
      </span>
      <div class="council-subject-footer background-1">
      <span class="right number">{{pst.commentNum}}</span>
      <img class="right"
      src="../../images/consultation/comment2.svg" style="width: 20px">
      <img class="left"
      src="../../images/consultation/viewed.svg" style="width:
      24px;margin-top: 2px;">
      <span class="left number">{{pst.seenNum}}</span>
      </div>
      </div>
      </div>
      </slick>
      </div>
      </div>
      </template>

      <script>
      import slick from 'vue-slick'
      import {eventBus} from "../../main";
      import axios from 'axios'

      export default {
      data: function () {
      return {
      posts: {},
      slickOptions: {
      slidesToShow: 4,
      centerMode: true,
      dots: true,
      arrows: true,
      responsive: [
      {
      breakpoint: 1024,
      settings: {
      slidesToShow: 3,
      slidesToScroll: 3,
      infinite: true,
      dots: true
      }
      },
      {
      breakpoint: 600,
      settings: {
      slidesToShow: 2,
      slidesToScroll: 2
      }
      },
      {
      breakpoint: 480,
      settings: {
      slidesToShow: 1,
      slidesToScroll: 1
      }
      }
      ]
      }
      }
      },
      beforeMount() {

      axios.get('https://www.test.magisterapp.ir/v2/student/post/all/1-5?sortby=seenNum')
      .then(res => {
      this.posts = res.data.posts
      })
      .catch(error => {
      console.log(error)
      })
      },
      methods: {
      createRandClass() {
      let color = math.floor((Math.random() * 4) + 1);
      return "color" + color
      },
      openPost(id, teacherId) {
      console.log(id)
      this.$router.push({
      name: "blogPost",
      query: {
      "id": id
      },
      params: {
      "teacherId": teacherId
      }
      })
      }
      },
      components: {
      slick
      }

      }
      </script>






      vue.js vue-component slick.js






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 2 at 8:00









      mohammad saleh asadimohammad saleh asadi

      13




      13
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54003029%2fvue-slick-slider-not-works-for-my-components-and-appearance-gets-ruined%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54003029%2fvue-slick-slider-not-works-for-my-components-and-appearance-gets-ruined%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas