Skip to content
This repository was archived by the owner on Jun 6, 2019. It is now read-only.

Commit d6b672c

Browse files
committed
add comments about weex.config.env
1 parent 9d7903a commit d6b672c

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/components/external-link.vue

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
<template>
2-
<div @click="open"><slot></slot></div>
2+
<div @click="open">
3+
<slot></slot>
4+
</div>
35
</template>
46

57
<script>
68
export default {
7-
props: {
8-
url: {
9-
type: String,
10-
default: ''
11-
}
12-
},
9+
props: ['url'],
1310
methods: {
1411
open () {
15-
if (this.$getConfig) {
16-
this.jump(`/article/${this.url}`)
17-
}
18-
else {
12+
// get the environment variables
13+
const env = weex.config.env || WXEnvironment
14+
15+
// open a new window (tab) on the web
16+
if (env.platform === 'Web') {
1917
window.open(this.url)
18+
return
2019
}
20+
21+
// change router path on native (Android & iOS)
22+
this.jump(`/article/${this.url}`)
2123
}
2224
}
2325
}

0 commit comments

Comments
 (0)