From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期三, 28 五月 2025 16:48:52 +0800 Subject: [PATCH] 初始化项目 --- uview-ui/components/u-link/u-link.vue | 89 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 89 insertions(+), 0 deletions(-) diff --git a/uview-ui/components/u-link/u-link.vue b/uview-ui/components/u-link/u-link.vue new file mode 100644 index 0000000..18212e6 --- /dev/null +++ b/uview-ui/components/u-link/u-link.vue @@ -0,0 +1,89 @@ +<template> + <text class="u-link" @tap.stop="openLink" :style="{ + color: color, + fontSize: fontSize + 'rpx', + borderBottom: underLine ? `1px solid ${lineColor ? lineColor : color}` : 'none', + paddingBottom: underLine ? '0rpx' : '0' + }"> + <slot></slot> + </text> +</template> + +<script> + /** + * link 瓒呴摼鎺� + * @description 璇ョ粍浠朵负瓒呴摼鎺ョ粍浠讹紝鍦ㄤ笉鍚屽钩鍙版湁涓嶅悓琛ㄧ幇褰㈠紡锛氬湪APP骞冲彴浼氶�氳繃plus鐜鎵撳紑鍐呯疆娴忚鍣紝鍦ㄥ皬绋嬪簭涓妸閾炬帴澶嶅埗鍒扮矘璐存澘锛屽悓鏃舵彁绀轰俊鎭紝鍦℉5涓�氳繃window.open鎵撳紑閾炬帴銆� + * @tutorial https://www.uviewui.com/components/link.html + * @property {String} color 鏂囧瓧棰滆壊锛堥粯璁�#606266锛� + * @property {String Number} font-size 瀛椾綋澶у皬锛屽崟浣峳px锛堥粯璁�28锛� + * @property {Boolean} under-line 鏄惁鏄剧ず涓嬪垝绾匡紙榛樿false锛� + * @property {String} href 璺宠浆鐨勯摼鎺ワ紝瑕佸甫涓奾ttp(s) + * @property {String} line-color 涓嬪垝绾块鑹诧紝榛樿鍚宑olor鍙傛暟棰滆壊 + * @property {String} mp-tips 鍚勪釜灏忕▼搴忓钩鍙版妸閾炬帴澶嶅埗鍒扮矘璐存澘鍚庣殑鎻愮ず璇紙榛樿鈥滈摼鎺ュ凡澶嶅埗锛岃鍦ㄦ祻瑙堝櫒鎵撳紑鈥濓級 + * @example <u-link href="http://www.uviewui.com">铚�閬撻毦锛岄毦浜庝笂闈掑ぉ</u-link> + */ + export default { + name: "u-link", + props: { + // 鏂囧瓧棰滆壊 + color: { + type: String, + default: '#497bff' + }, + // 瀛椾綋澶у皬锛屽崟浣峳px + fontSize: { + type: [String, Number], + default: 28 + }, + // 鏄惁鏄剧ず涓嬪垝绾� + underLine: { + type: Boolean, + default: false + }, + // 瑕佽烦杞殑閾炬帴 + href: { + type: String, + default: '' + }, + // 灏忕▼搴忎腑澶嶅埗鍒扮矘璐存澘鐨勬彁绀鸿 + mpTips: { + type: String, + default: '閾炬帴宸插鍒讹紝璇峰湪娴忚鍣ㄦ墦寮�' + }, + // 涓嬪垝绾块鑹� + lineColor: { + type: String, + default: '' + } + }, + methods: { + openLink() { + // #ifdef APP-PLUS + plus.runtime.openURL(this.href) + // #endif + // #ifdef H5 + window.open(this.href) + // #endif + // #ifdef MP + uni.setClipboardData({ + data: this.href, + success: () => { + uni.hideToast(); + this.$nextTick(() => { + this.$u.toast(this.mpTips); + }) + } + }); + // #endif + } + } + } +</script> + +<style lang="scss" scoped> + @import "../../libs/css/style.components.scss"; + + .u-link { + line-height: 1; + } +</style> -- Gitblit v1.9.3