Android 扩展Component v-for 空白,不使用v-for 可以显示
public class RichText extends WXComponent {
public RichText(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy) {
super(instance, dom, parent, isLazy);
}
@Override
protected void initView() {
mHost=new TextView(mContext);
((TextView)mHost).setMovementMethod(LinkMovementMethod.getInstance());
}
@WXComponentProp(name = "tel")
public void setTelLink(String tel){
SpannableString spannable=new SpannableString(tel);
spannable.setSpan(new URLSpan("tel:"+tel),0,tel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
((TextView)mHost).setText(spannable);
}
}
vue
<template>
<div>
<richText v-for="item in list" tel="12305" style="width:200;height:100">12305</richText>
</div>
</template>
<script>
export default{
data(){
return {
list:[1,2,3]
}
}
}
</script>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…