close #5378
This commit is contained in:
parent
72979a782a
commit
5465ae45f7
2 changed files with 14 additions and 5 deletions
|
@ -220,7 +220,9 @@
|
||||||
<Button type="default">Small</Button>
|
<Button type="default">Small</Button>
|
||||||
</Button-group>
|
</Button-group>
|
||||||
|
|
||||||
<br><br><br><br><br>
|
<br><br>
|
||||||
|
<Button to="/icon">Open New Window</Button>
|
||||||
|
<br><br><br>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -43,11 +43,18 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleClick (new_window = false) {
|
handleClick (new_window = false) {
|
||||||
|
const router = this.$router;
|
||||||
|
|
||||||
if (new_window) {
|
if (new_window) {
|
||||||
window.open(this.to);
|
let to = this.to;
|
||||||
|
if (router) {
|
||||||
|
const current = this.$route;
|
||||||
|
const route = router.resolve(this.to, current, this.append);
|
||||||
|
to = route ? route.href : this.to;
|
||||||
|
}
|
||||||
|
window.open(to);
|
||||||
} else {
|
} else {
|
||||||
const isRoute = this.$router;
|
if (router) {
|
||||||
if (isRoute) {
|
|
||||||
this.replace ? this.$router.replace(this.to) : this.$router.push(this.to);
|
this.replace ? this.$router.replace(this.to) : this.$router.push(this.to);
|
||||||
} else {
|
} else {
|
||||||
window.location.href = this.to;
|
window.location.href = this.to;
|
||||||
|
|
Loading…
Add table
Reference in a new issue