• html jquery vue php 混合使用


    {extend name="base" /}
    {block name="main"}
    <style>
        .product-button-prev.swiper-button-prev::after, .product-button-next.swiper-button-next::after {
            content: ''
        }
    style>
    <div class="container Wauto">
        <div class="sliderbox">
            <div class="slider">
                <div id="slideBox" class="slideBox">
                    <ul id="slider">
                        {ld:slide name="banner"}
                        <li class="slide">
                            <img src="{$item.image}" alt="{$item.title}"/>
                            <div class="container slide-content text-center">
                                {$item.content}
                            div>
                        li>
                        {/ld:slide}
                    ul>
                div>
            div>
        div>
        <div class="main w1200">
            <div class="article w1" style="margin: 0">
                <div class="g-product" id="app-product">
                    <div class="continer1">
                        <div class="product_content">
                            <div class="g-top wow fadeInUp animated" style="visibility: visible; animation-name: fadeInUp;">
                                <h2>产品中心h2>
                                <h4>PRODUCT CENTERh4>
                            div>
                            <div class="product_top wow fadeInUp animated" style="visibility: visible; animation-name: fadeInUp;">
                                {ld:nav pid="144"}
                                <a href="#pro-{$item.id}" class="product {$i===1?'active':''}" @click="handleClickPro({$item.id})">{$item.name}a>
                                {/ld:nav}
                            div>
                            <my-swiper :key="products.length" :reach-end="handleReachEnd" :initial-slide="initialSlide">
                                <div class="swiper-slide" v-for="(product,index) in products" :key="product.id">
                                    <a :href="product.url" class="product_po wow zoomIn animated" style="visibility: visible; animation-name: zoomIn;">
                                        <div class="pic">
                                            <img :src="product.image"/>
                                        div>
                                        <p>{{product.title}}p>
                                    a>
                                div>
                            my-swiper>
    
                            <a href="/chanpinzhongxin.html" class="welcome_but wow fadeInUp animated" style="visibility: visible; animation-name: fadeInUp;">+查看更多a>
                        div>
                    div>
                div>
    
                {include file="index/company" /}
    
                <div class="g-news" id="app-news">
                    <div class="continer1">
                        <div class="news_content">
                            <div class="g-top wow fadeInUp animated" style="visibility: visible; animation-name: fadeInUp;">
                                <h2>新闻资讯h2>
                                <h4>NEWS INFORMATIONh4>
                            div>
                            <div class="news_row">
                                <div class="news_left wow fadeInLeft animated" style="visibility: visible; animation-name: fadeInLeft;">
                                    <my-swiper-news :key="newsList.length">
                                        <div class="swiper-slide" v-for="(news,index) in imgList" :key="news.id">
                                            <a :href="news.url" class="news_po">
                                                <div class="pic">
                                                    <img :src="news.image"/>
                                                div>
                                                <div class="news_po_min">
                                                    <p>{{news.title}}p>
                                                div>
                                            a>
                                        div>
                                    my-swiper-news>
                                div>
                                <div class="news_right wow fadeInRight animated" style="visibility: visible; animation-name: fadeInRight;">
                                    <a :href="news.url" class="news_wrap_content" v-for="news in newsList" :key="news.id">
                                        <div class="news_wrap_time">
                                            <h2>{{news.show_time.slice(8,10)}}h2>
                                            <h4>{{news.show_time.slice(0,7)}}h4>
                                        div>
                                        <div class="news_right_content">
                                            <h3>{{news.title}}h3>
                                            <p>{{news.description}}<span style="color:#92D050;">[+查看详情]span>p>
                                        div>
                                    a>
                                div>
                            div>
                            <a href="/xinwenzhongxin.html" class="welcome_but wow fadeInUp animated" style="visibility: visible; animation-name: fadeInUp;">+查看更多a>
                        div>
                    div>
                div>
    
                {include file="index/case" /}
    
            div>
        div>
    div>
    <script>
        const MySwiper = {
            template: `
             
    `
    , props: { reachEnd: { type: Function, required: true }, initialSlide: { type: Number, default: 0 } }, mounted() { const that = this new Swiper('.product_swiper .swiper-container', { initialSlide: that.initialSlide, autoplay: { disableOnInteraction: false, pauseOnMouseEnter: true, stopOnLastSlide: true, delay:1000 }, //自动播放 loop: false, slidesPerView: 1, spaceBetween: 5, navigation: { nextEl: ".product-button-next", prevEl: ".product-button-prev", }, breakpoints: { 992: { slidesPerView: 4, spaceBetween: 40, }, 600: { slidesPerView: 2, spaceBetween: 20, } }, observer: true, //修改swiper自己或子元素时,自动初始化swiper observeParents: true, on: { reachEnd: that.reachEnd } }); } } new Vue({ el: '#app-product', components: { 'my-swiper': MySwiper }, data: { products: [], productId: 151, list_rows: 8, page: 1, isLastPage: false, loading: false, initialSlide: 0, }, methods: { fetchProduct(params = {}) { if (this.isLastPage) { return } params = {cid: this.productId, page: 1, limit: {page: this.page, list_rows: this.list_rows}, ...params} this.loading = true $http.get('/api.v1/lists', {params}).then(res => { if (params.limit.page !== 1) { if (params.limit.page === res.last_page) { this.isLastPage = true } this.products = [...this.products, ...res.data] } else { this.products = res.data } }).finally(() => { this.loading = false }) }, handleClickPro(id) { this.productId = id this.page = 1 this.isLastPage = false this.initialSlide=0 this.fetchProduct() }, handleReachEnd(e) { if (this.loading) return this.page++ this.initialSlide = e.activeIndex this.fetchProduct({limit: {page: this.page, list_rows: this.list_rows}}) } }, created() { this.fetchProduct() }, }) const MySwiperNews = { template: `
    `
    , mounted() { new Swiper('.news_swiper .swiper-container', { autoplay: true, //自动播放 // speed: 1000, loop: true, pagination: { el: '.swiper-pagination', clickable: true, }, observer: true, //修改swiper自己或子元素时,自动初始化swiper observeParents: true, }); } } new Vue({ el: '#app-news', components: { 'my-swiper-news': MySwiperNews }, data: { newsList: [], list_rows: 6, page: 1, }, methods: { fetchNews(params = {}) { params = {mid: 2, page: 1, _order: 'show_time DESC,id DESC', limit: {page: this.page, list_rows: this.list_rows}, ...params} $http.get('/api.v1/lists', {params}).then(res => { if (params.limit.page !== 1) { this.newsList.push(...res.data) } else { this.newsList = res.data } this.newsList.forEach(item => { item.description = item.description.slice(0, 40).concat('...') }) }) }, }, created() { this.fetchNews() }, computed: { imgList: function () { return this.newsList.slice(0, 4) } } }) $('.product_content .product').click(function (e) { e.preventDefault() $(this).addClass('active').siblings().removeClass('active') })
    script> {/block}
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
  • 相关阅读:
    计数排序算法
    SQL查询优化---单表使用索引及常见索引失效优化
    Redis实现分布式锁
    使用java mail SMTPTransport发送邮箱,本地秒到,一上服务器就20-30s左右,生产环境直接发送失败。
    python笔记Ⅶ--函数返回值、作用域与命名空间、递归
    Python标准库
    如何打造智能公厕:实现智慧监测、自动化运营和智慧化管理
    Kubernetes简介篇
    Redis
    代码审查工具:Fortify
  • 原文地址:https://blog.csdn.net/WhitEKinGdom08/article/details/133743362