HBuilder X 开发小程序,自定义组件报错:Unexpected digit after hash token

在HBuilder X 开发小程序项目时,自定义组件出现的错误: Module build failed (from ./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js): 15:04:06.283 语法错误: Unexpected digit after hash token (23:15)

<template>
    <view class="my-search-container" :style="{'background-color':bgcolor}" @click="searchBoxHandler">
        <view class="my-search-box" :style="{'border-radius':radius + 'px'}">
          <!-- 使用uni-ui图标组件 -->
          <uni-icons type="search" size="17"></uni-icons>
          <text class="placeholder">搜索 </text>
        </view>
      </view>
  
</template>

<script>
  export default {
    name:"my-search",
    props: {
      //背景颜色
            bgcolor:{
              type:String,
              default:' #005500'
            },
            //圆角尺寸
            radius:{
              type:Number,
              default: 18 
            }
    },
    data() {
      return {
        
      }
    },
    methods:{
      searchBoxHandler(){
        console.log(1)
        this.$emit('click')
      }
    }
  }
</script>

<style lang="scss">
.my-search-container {
  height: 50px;
  // background-color:#005500;
  display: flex;
  align-items: center;
  padding: 0 10px;
  .my-search-box {
    height: 36px;
    background-color: #fff;
    // border-radius: 18px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    .placeholder {
      font-size: 15px;
      margin-left: 5px;
    }
  }
}
</style>

语法错误,找了很久没找到,其实就是定义的数据类型是字符串,然后写颜色的时候忘记加引号‘’

 

记录报错日常,下次别踩坑了!

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值