【uni-app】在新窗口中打开链接
生活随笔
收集整理的這篇文章主要介紹了
【uni-app】在新窗口中打开链接
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言
- 在 uni-app 應用中,<a href="xxx" target="_blank">打開新頁面</>不能實現預期的效果(在新窗口中打開頁面)。
- uni-app 應用運行到chrome瀏覽器中
在新窗口中打開外部鏈接
<template><view class="content"><navigator url="#" @click="openBaidu">在新窗口中打開百度</navigator></view> </template><script>export default {data() {return {}},methods: {openBaidu: function() {var href = "http://www.baidu.com";window.open(href, '_blank');},}} </script>在新窗口中打開內部鏈接
<template><view class="content"><navigator url="#" @click="openCompany">在新窗口中打開company</navigator></view> </template><script>export default {data() {return {}},methods: {openCompany: function() {var { href } = this.$router.resolve({ path: "pages/company/company", query: { id: 1 } }); window.open(href, '_blank');},}} </script>總結
以上是生活随笔為你收集整理的【uni-app】在新窗口中打开链接的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Mybatis】resultMap继承
- 下一篇: Mac如何压缩文件Mac如何压缩文件为r