Hbuilderx3.92 uni-app自定义.uvue组件 * @property {String} text 显示的文字不生效不能正常提示

Hbuilderx3.92 uni-app自定义.uvue组件 * @property {String} text 显示的文字不生效不能正常提示

开发环境 版本号 项目创建方式
Windows

示例代码:

t-link.uvue
<template>
<view class="uni-row">
<text class="text" :href="href" @click="openURL" :inWhiteList="inWhiteList">{{text}}</text>
</view>
</template> 
<script lang="uts">
/**
  @description u-link是一个外部网页超链接组件,在小程序内打开内部web-view组件或复制url,在app内打开外部浏览器,在h5端打开新网页  
  [@property](/user/property) {String} href imyadfs修改  
  [@property](/user/property) {String} text 显示的文字  
  [@property](/user/property) {Boolean} inWhiteList 是否在小程序白名单中,如果在的话,在小程序端会直接打开内置web-view,否则会只会复制url,提示在外部打开  
  @example 
<u-link href="https://ext.dcloud.net.cn" text="https://ext.dcloud.net.cn" :inWhiteList="true"></u-link>
/
export default {
name: 'u-link',
props: {
href: {
type: String,
default: ''
},
text: {
type: String,
default: ''
},
inWhiteList: {
type: Boolean,
default: false
}
},
methods: {
openURL() {
// // #ifdef APP-PLUS
// plus.runtime.openURL(this.href) //这里默认使用外部浏览器打开而不是内部web-view组件打开
// // #endif
// // #ifdef H5
// window.open(this.href)
// // #endif
// // #ifdef MP
// if (this.inWhiteList) { //如果在小程序的网址白名单中,会走内置webview打开,否则会复制网址提示在外部浏览器打开
//  uni.navigateTo({
//      url: '/pages/component/web-view/web-view?url=' + this.href
//  });
// } else {
//  uni.setClipboardData({
//      data: this.href
//  });
//  uni.showModal({
//      content: '本网址无法直接在小程序内打开。已自动复制网址,请在手机浏览器里粘贴该网址',
//      showCancel: false
//  });
// }
// #endif
}
}
}
</script> 
.text {
color: #7A7E83;
font-size: 14px;
line-height: 20px;
/* border-bottom: 1px solid #7A7E83; */
}

操作步骤:

当自定义.uvue组件的时候

预期结果:

和自定义.vue组件保持一致

实际结果:

自定义uvue组件 [@property](/user/property) {String} text 显示的文字不生效不能正常提示, 自定义.vue组件 `@property {String}正常提示,


![Image](https://www.itying.com/uniimg.php?url=https://img-cdn-tc.dcloud.net.cn/uploads/questions/20231013/77866e34809bc08b12a181ae70421e82.png)

![Image](https://www.itying.com/uniimg.php?url=https://img-cdn-tc.dcloud.net.cn/uploads/questions/20231013/b41f61204d9bf483fe5ca4e74f811585.png)

![Image](https://www.itying.com/uniimg.php?url=https://img-cdn-tc.dcloud.net.cn/uploads/questions/20231013/f27db8bd79214f71f7cc60c634a74278.png)

更多关于Hbuilderx3.92 uni-app自定义.uvue组件 * @property {String} text 显示的文字不生效不能正常提示的实战教程也可以访问 https://www.itying.com/category-93-b0.html

回到顶部