我正在使用以下代码片段在默认浏览器中打开链接。
<template>
<div>
<a @click.prevent="fireUpLink">External Link</a>
</div>
</template>
.
<script>
/* global nw */
export default {
methods: {
fireUpLink: function() {
nw.Shell.openExternal("http://example.com/");
}
}
};
</script>
但是假设我有数千个链接,则此解决方案不可扩展。还有更好的办法吗?
最佳答案
在 Vue SFC 中,它期望在组件中定义或导入引用的变量,或者是全局的。如果您从全局窗口对象引用它,它应该可以工作。
window.nw.Shell.openExternal('http://example.com');
关于node-webkit - 节点 webkit : open thousands of urls in browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66866998/