File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<template >
2- <view style =" text-decoration :underline " :href =" href" @click =" openURL() " :inWhiteList =" inWhiteList" > {{text}} </view >
2+ <view style =" text-decoration :underline " :href =" href" @click =" openURL" :inWhiteList =" inWhiteList" >{{text}}</view >
33</template >
44
55<script >
66 export default {
77 name: ' u-link' ,
8- props: [' href' , ' text' , ' inWhiteList' ],
9- onLoad () {
10-
8+ props: {
9+ href: {
10+ type: String ,
11+ default: ' '
12+ },
13+ text: {
14+ type: String ,
15+ default: ' '
16+ },
17+ inWhiteList: {
18+ type: Boolean ,
19+ default: false
20+ }
1121 },
1222 methods: {
1323 openURL () {
1828 window .open (this .href )
1929 // #endif
2030 // #ifdef MP
21- if (typeof ( this .inWhiteList ) != " undefined " && this . inWhiteList == true ) { // 如果在小程序的网址白名单中,会走内置webview打开,否则会复制网址提示在外部浏览器打开
31+ if (this .inWhiteList ) { // 如果在小程序的网址白名单中,会走内置webview打开,否则会复制网址提示在外部浏览器打开
2232 uni .navigateTo ({
23- url: ' /pages/component/web-view/web-view?url=' + this .href ,
24- success : res => {},
25- fail : () => {},
26- complete : () => {}
33+ url: ' /pages/component/web-view/web-view?url=' + this .href
2734 });
2835 } else {
2936 uni .setClipboardData ({
3037 data: this .href
31- })
38+ });
3239 uni .showModal ({
3340 content: ' 本网址无法直接在小程序内打开。已自动复制网址,请在手机浏览器里粘贴该网址' ,
3441 showCancel: false
35- })
42+ });
3643 }
3744 // #endif
3845 }
39- },
40-
46+ }
4147 }
4248 </script >
4349
Original file line number Diff line number Diff line change 1717 </view >
1818 </view >
1919</template >
20- <script >
20+ <script >
2121 import uLink from " @/components/uLink.vue"
2222 export default {
2323 data () {
120120 url: ' /pages/extUI/' + path + ' /' + path
121121 });
122122 }
123- },components: {
124- uLink
123+ },
124+ components: {
125+ uLink
125126 }
126127 }
127128 </script >
147148 .uni-hello-text {
148149 word-break : break-all ;
149150 }
150- </style >
151+ </style >
You can’t perform that action at this time.
0 commit comments