老师,请问一下为什么会报错呢?

老师,请问一下为什么会报错呢?

# 具体遇到的问题

# 报错信息的截图
http://img1.sycdn.imooc.com//climg/5fdeedf409f24ef613660768.jpg# 相关课程内容截图

# 尝试过的解决思路和结果

# 粘贴全部相关代码,切记添加代码注释(请勿截图)

<template>

    <div>

        <div class="banner" @click="handleBannerClick">

            <img class="banner-img" :src="bannerImg" alt="">

            <div class="banner-info">

                <div class="banner-title">{{this.sightName}}</div>

                <div class="banner-number">

                    <span class="iconfont banner-icon">&#xe647;</span>

                    {{this.bannerImgs.length}}

                </div>


            </div>

        </div>

        <fade-animation>

            <common-gallary :imgs="bannerImgs" v-show="showGallary" @close="handleGallaryClose"></common-gallary>

        </fade-animation>

    </div>

</template>


<script>

import CommonGallary from 'common/gallary/Gallary'

import FadeAnimation from 'common/fade/FadeAnimation'

export default {

    name:'DetailBanner',

    props:{

        sightName:String,

        bannerImg:String,

        bannerImgs:Array

    },

     components:{

        CommonGallary,

        FadeAnimation

    },

    data () {

        return {

            showGallary:false,

            

        }

        

    },

    methods:{

        handleBannerClick () {

            this.showGallary=true;

        },

        handleGallaryClose () {

            this.showGallary=false;

        }

    }



<template>

    <div>

      <detail-banner

       :sightName="sightName" :bannerImg="bannerImg"

       :bannerImgs="gallaryImgs"

      ></detail-banner>

      <detail-banner ></detail-banner>

      <detail-header></detail-header>    

    <div class="content">

        <detail-list :list="list"></detail-list>

    </div>

    </div>

</template>


<script>

import DetailBanner from './components/Banner'

import DetailHeader from './components/Header'

import DetailList from './components/List'

import axios from 'axios'

export default {

    name:'Detail',

    components:{

        DetailBanner,

        DetailHeader,

        DetailList

    },

    data() {

        return {

            sightName:'',

            bannerImg:'',

            gallaryImgs:[],

            list:[]

        }

    },

    methods:{

        getDetailInfo () {

            // axios.get('/api/detail.json?id='+this.$route.params.id)

             axios.get('/api/detail.json',{

                 params:{

                     id:this.$route.params.id

                 }

             }).then(this.handleGetDataSucc)


        },

        handleGetDataSucc (res) {

            res=res.data

            if(res.ret && res.data){

                const data=res.data

                // console.log(data)

                this.sightName=data.sightName

                this.bannerImg=data.bannerImg

                this.gallaryImgs=data.gallaryImgs

                this.list=data.categoryList

            }

        }

    },

    mounted () {

        this.getDetailInfo();

    }

}

</script>


<style lang="stylus" scoped>

    .content

        height:50rem;

</style>

   

}

</script>


<style lang="stylus" scoped>

    .banner

        position:relative;

        overflow:hidden;

        height:0;

        padding-bottom:55%;

        .banner-img

            width:100%;

        .banner-info

            display:flex;

            position:absolute;

            left:0;

            right:0;

            bottom:0;

            line-height:.6rem;

            color:#fff;  

            background-image:linear-gradient(top,rgba(0,0,0,0),rgba(0,0,0,.8));         

            .banner-title

                flex:1;

                font-size:.32rem;

                padding:0 .2rem;

            .banner-number

                margin-top:.14rem;

                padding:0 .4rem;

                height:.32rem;

                line-height:.32rem;

                border-radius:.2rem;

                background:rgba(0,0,0,.8);

                font-size:.24rem;

                .banner-icon

                    font-size:.24rem;

                    padding-right:.2rem;

</style>

​在这里输入代码,可通过选择【代码语言】突出显示

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕星星 2020-12-20 17:49:55

同学你好,代码中使用了两边banner组件,去掉第二次的即可

http://img1.sycdn.imooc.com//climg/5fdf1e3e09cbe3ec07120390.jpg

祝学习愉快!

  • 老师您好,请问这个报错怎么解决?https://img1.sycdn.imooc.com//climg/618ca0f009cbb2eb09620189.jpg

    2021-11-11 12:50:32
  • 同学你好,报错信息是没有加载到common/gallary模块 。课程中banner组件中引入了gallary模块,是这样的:

    https://img1.sycdn.imooc.com//climg/618cea93095adb4a10200336.jpg

    建议检查自己写的路径是否正确。祝学习愉快!

    2021-11-11 18:04:43
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师