自定义组件报错,
VM79506:2 webviewScriptError
Cannot read property 'replace' of undefined;[Exparser] [Error] [Component] Lifetime Method Error @ wx-cover-view#attached
TypeError: Cannot read property 'replace' of undefined
at o.attached (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:8:5912)
at r.safeCallback (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:5:27178)
at r.call (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:5:26942)
at t (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:6:7737)
at t (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:6:8050)
at t (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:6:7992)
at t (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:6:8050)
at t (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:6:8050)
at t (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:6:8050)
at t (http://127.0.0.1:64847/__pageframe__/__dev__/WAWebview.js:6:8050)
(anonymous) @ VM79506:2
VM79507:2 [Exparser] [Error] [Component] Lifetime Method Error @ wx-cover-view#attached
(anonymous) @ VM79507:2
VM79508:2 TypeError: Cannot read property 'replace' of undefined
at o.attached (:64847/__pageframe__/__dev__/WAWebview.js:8)
at r.safeCallback (:64847/__pageframe__/__dev__/WAWebview.js:5)
at r.call (:64847/__pageframe__/__dev__/WAWebview.js:5)
at t (:64847/__pageframe__/__dev__/WAWebview.js:6)
at t (:64847/__pageframe__/__dev__/WAWebview.js:6)
at t (:64847/__pageframe__/__dev__/WAWebview.js:6)
at t (:64847/__pageframe__/__dev__/WAWebview.js:6)
at t (:64847/__pageframe__/__dev__/WAWebview.js:6)
at t (:64847/__pageframe__/__dev__/WAWebview.js:6)
at t (:64847/__pageframe__/__dev__/WAWebview.js:6)
(anonymous) @ VM79508:2
组件如下:
js:
Component({
properties: {
top: {
type: Number,
value: 0
},
left: {
type: Number,
value: 0
},
iconSrc: {
type: String,
value: ''
},
animation: {
type: Object,
value: {}
}
}
});
wxml:
<cover-view class="indicator" style="top:{{top}}rpx; left:{{left}}rpx;" animation="{{animation}}">
<cover-view class="indicator-tip">
<cover-image class="indicator-icon" src="{{iconSrc}}"></cover-image>
<!--a-->
<slot></slot>
</cover-view>
</cover-view>
wxss:
.indicator{
opacity: 0.6;
z-index: 999;
color: white;
font-size: 26rpx;
position: absolute;
background-color: #565A5C;
}
.indicator-tip{
margin: 24rpx 42rpx;
display: flex;
justify-content: space-around;
}
.indicator-icon{
width: 36rpx;
height: 36rpx;
margin-right: 10rpx;
}
json:
{
"component": true
}
组件使用:
json:
{
"disableScroll": true,
"usingComponents": {
"mapindicator": "/pages/components/mapindicator/mapindicator"
}
}
wxml:
<mapindicator top="800" left="" iconSrc="/static/images/clear/clear-all.png">xxxxxxxxxxxxxx</mapindicator>
相似问题