简体   繁体   English

如何使用node.js(cloud9 IDE)创建和打开新(N个)选项卡

[英]How to create and open new (N number of ) tabs using node.js (cloud9 IDE)

I am trying to do a choice provider. 我试图做一个选择提供者。 which will take a (choice) program with n number of choices 这将需要一个具有n个选择的(选择)程序

For example : 例如 :

Lets say wanted to make a coffee have to choices- 可以说要煮咖啡有多种选择-
1. < light, dark> 1. <亮,暗>
2. < with sugar , without sugar> 2. <加糖,不加糖>
( i know its a bad example) (我知道这是一个不好的例子)
Then my program should make four new routes/tabs and should open four tabs having 然后,我的程序应制作四个新的路线/标签,并打开四个包含以下内容的标签
1. light coffee with sugar.. 1.轻咖啡加糖..
2. light coffee without sugar... 2.不含糖的淡咖啡...
3 and 4 with dark. 3和4与黑暗。

Tabs are considered to show those are four different things that came from single source file (which supposed to be ac program,explained with coffee here) 选项卡被认为可以显示来自单一源文件(应该是ac程序,在这里用咖啡解释)中的四种不同内容。

I know opening a new tab can be done using 我知道可以使用打开新标签页

button(type="button", onclick="window.open('auth/google', '_blank');")

To sum up all my question is 总结我所有的问题是
"Giving a text/program having choices should create and open up all possible choices as new tabs." “给出具有选择的文本/程序应该创建并打开所有可能的选择作为新选项卡。” (1.In a same window, like ext js calender application with day weeks months tabs, but I heard there is no way for that in node.js,correct me if I am wrong. or 2. as Separate window tabs) (1.在同一个窗口中,例如带有extday月份标签的ext js calender应用程序,但是我听说在node.js中没有办法解决这个问题,如果我错了,请纠正我。或2.作为单独的窗口标签

PS: new to node.js no harsh comments please. PS:node.js的新手,请不要发表苛刻的评论。 any link that can infer my doubts appreciated 任何可以推断出我怀疑的链接

I dont know if you have an answer to solve your problem, but you can use the npm-open module with node servers. 我不知道您是否有解决问题的答案,但是您可以将npm-open模块与节点服务器一起使用。 Just a quick runthrough: 快速浏览:

command line: npm install open 

You can then open 4 different tabs from 4 different html pages that you create dynamically or statically. 然后,您可以从动态或静态创建的4个不同的html页中打开4个不同的标签。 Make sure you have the port open 确保端口打开

var open = require('open');    
open('http://localhost:' + port + '/' + option.html , 'browser'); 

Hope that helps! 希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM