Initial commit

This commit is contained in:
yuantao
2025-09-29 14:05:25 +08:00
commit 6f0bb2f949
579 changed files with 99061 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/*
* @Author : LQ
* @Description :
* @version : 1.0
* @Date : 2021-08-20 16:44:21
* @LastAuthor : LQ
* @lastTime : 2021-08-20 17:45:36
* @FilePath : /u-view2.0/uview-ui/libs/config/props/link.js
*/
import config from '../../libs/config/config'
const {
color
} = config
export default {
// link超链接组件props参数
link: {
color: color['u-primary'],
fontSize: 15,
underLine: false,
href: '',
mpTips: '链接已复制,请在浏览器打开',
lineColor: '',
text: ''
}
}

View File

@@ -0,0 +1,41 @@
import { defineMixin } from '../../libs/vue'
import defProps from '../../libs/config/props.js'
export const props = defineMixin({
props: {
// 文字颜色
color: {
type: String,
default: () => defProps.link.color
},
// 字体大小单位px
fontSize: {
type: [String, Number],
default: () => defProps.link.fontSize
},
// 是否显示下划线
underLine: {
type: Boolean,
default: () => defProps.link.underLine
},
// 要跳转的链接
href: {
type: String,
default: () => defProps.link.href
},
// 小程序中复制到粘贴板的提示语
mpTips: {
type: String,
default: () => defProps.link.mpTips
},
// 下划线颜色
lineColor: {
type: String,
default: () => defProps.link.lineColor
},
// 超链接的问题不使用slot形式传入是因为nvue下无法修改颜色
text: {
type: String,
default: () => defProps.link.text
}
}
})

View File

@@ -0,0 +1,87 @@
<template>
<text
class="u-link"
@tap.stop="openLink"
:style="[linkStyle, addStyle(customStyle)]"
>{{text}}</text>
</template>
<script>
import { props } from './props';
import { mpMixin } from '../../libs/mixin/mpMixin';
import { mixin } from '../../libs/mixin/mixin';
import { addStyle, addUnit, getPx, toast } from '../../libs/function/index';
/**
* link 超链接
* @description 该组件为超链接组件在不同平台有不同表现形式在APP平台会通过plus环境打开内置浏览器在小程序中把链接复制到粘贴板同时提示信息在H5中通过window.open打开链接。
* @tutorial https://ijry.github.io/uview-plus/components/link.html
* @property {String} color 文字颜色 (默认 color['u-primary']
* @property {String Number} fontSize 字体大小单位px (默认 15
* @property {Boolean} underLine 是否显示下划线 (默认 false
* @property {String} href 跳转的链接要带上http(s)
* @property {String} mpTips 各个小程序平台把链接复制到粘贴板后的提示语(默认“链接已复制,请在浏览器打开”)
* @property {String} lineColor 下划线颜色默认同color参数颜色
* @property {String} text 超链接的问题不使用slot形式传入是因为nvue下无法修改颜色
* @property {Object} customStyle 定义需要用到的外部样式
*
* @example <u-link href="http://www.uviewui.com">蜀道难,难于上青天</u-link>
*/
export default {
name: "u-link",
mixins: [mpMixin, mixin, props],
computed: {
linkStyle() {
const style = {
color: this.color,
fontSize: addUnit(this.fontSize),
// line-height设置为比字体大小多2px
lineHeight: addUnit(getPx(this.fontSize) + 2),
textDecoration: this.underLine ? 'underline' : 'none'
}
// if (this.underLine) {
// style.borderBottomColor = this.lineColor || this.color
// style.borderBottomWidth = '1px'
// }
return style
}
},
emits: ["click"],
methods: {
addStyle,
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(() => {
toast(this.mpTips);
})
}
});
// #endif
this.$emit('click')
}
}
}
</script>
<style lang="scss" scoped>
@import "../../libs/css/components.scss";
$u-link-line-height:1 !default;
.u-link {
/* #ifndef APP-NVUE */
line-height: $u-link-line-height;
/* #endif */
@include flex;
flex-wrap: wrap;
flex: 1;
}
</style>