This commit is contained in:
梁灏 2019-04-08 18:09:29 +08:00
parent 72979a782a
commit 5465ae45f7
2 changed files with 14 additions and 5 deletions

View file

@ -220,7 +220,9 @@
<Button type="default">Small</Button>
</Button-group>
<br><br><br><br><br>
<br><br>
<Button to="/icon">Open New Window</Button>
<br><br><br>
</div>
</template>
<script>

View file

@ -43,11 +43,18 @@ export default {
},
methods: {
handleClick (new_window = false) {
if (new_window){
window.open(this.to);
const router = this.$router;
if (new_window) {
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 {
const isRoute = this.$router;
if (isRoute) {
if (router) {
this.replace ? this.$router.replace(this.to) : this.$router.push(this.to);
} else {
window.location.href = this.to;