|
本帖最后由 JasonMa 于 2018-5-7 16:12 编辑
- <template>
- <!-- template里只能有一个根节点 -->
- <div class="movielist-comp">
- <list class="comp-itmes" id="comp-itmes">
- <block for="(index, item) in movieList.data">
- <list-item class="item-movie" type="movie-item" onclick="clickTab(index)">
- <image class="normalImg" src="{{ item.img }}"></image>
- <text class="normalTxt">{{ item.title }}</text>
- </list-item>
- </block>
- </list>
- </div>
- </template>
- <script>
- export default {
- props: ['movieList'],
- onReady() {
- this.moveTolist();
- },
- moveTolist() {
- this.$element('comp-itmes').scrollTo({
- index: this.movieList.now
- });
- },
- clickTab(index) {
- this.movieList.now = index;
- this.moveTolist();
- }
- };
- </script>
复制代码
|
|