123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <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';
-
- export default {
- name: "u-link",
- mixins: [mpMixin, mixin, props],
- computed: {
- linkStyle() {
- const style = {
- color: this.color,
- fontSize: addUnit(this.fontSize),
-
- lineHeight: addUnit(getPx(this.fontSize) + 2),
- textDecoration: this.underLine ? 'underline' : 'none'
- }
-
-
-
-
- return style
- }
- },
- emits: ["click"],
- methods: {
- addStyle,
- openLink() {
-
- plus.runtime.openURL(this.href)
-
-
- window.open(this.href)
-
-
- uni.setClipboardData({
- data: this.href,
- success: () => {
- uni.hideToast();
- this.$nextTick(() => {
- toast(this.mpTips);
- })
- }
- });
-
- this.$emit('click')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "../../libs/css/components.scss";
- $u-link-line-height:1 !default;
- .u-link {
-
- line-height: $u-link-line-height;
-
- @include flex;
- flex-wrap: wrap;
- flex: 1;
- }
- </style>
|