123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <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>
-
- export default {
- name: "u-link",
- props: {
-
- color: {
- type: String,
- default: '#2979ff'
- },
-
- 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() {
-
- plus.runtime.openURL(this.href)
-
-
- window.open(this.href)
-
-
- uni.setClipboardData({
- data: this.href,
- success() {
- uni.hideToast();
- }
- });
- this.$nextTick(() => {
- this.$u.toast(this.mpTips);
- })
-
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .u-link {
- line-height: 1;
- }
- </style>
|