我使用icomoon作为字体图标。我已将图标插入我的应用程序,但是现在我想附加一个链接以打开浏览器。我试图在utils函数中使用“ tap”属性来打开这样的浏览器:
home-page.js文件
var vmModule = require("./home-view-model");
var utilityModule = require("tns-core-modules/utils/utils");
function pageLoaded(args) {
var page = args.object;
page.bindingContext = vmModule.mainViewModel;
}
exports.pageLoaded = pageLoaded;
exports.onPeripheralTap = vmModule.mainViewModel.onPeripheralTap;
exports.launch = function(){
utilityModule.openUrl("https://www.facebook.com/ZoneFirst/");
}
xml文件
<StackLayout orientation="horizontal" horizontalAlignment="center" width="auto" height="auto">
<Label text= "" class="icon-facebook" paddingTop = "30" tap="launch"/>
<Label text= "" class="icon-twitter" paddingTop = "30" paddingLeft = "20" />
<Label text= "" class="icon-youtube" paddingTop = "30" paddingLeft = "20"/>
<Label text= "" class="icon-linkedin" paddingTop = "30" paddingLeft = "20"/>
</StackLayout>
css文件
.icon-facebook {
font-family: "icomoon";
/* content: "\ea91"; */
font-size: 42;
color: #3B5998;
}
.icon-twitter {
font-family: "icomoon";
/* content: "\ea96"; */
font-size: 42;
color: #1DA1F2;
}
.icon-youtube {
font-family: "icomoon";
/* content: "\ea9d"; */
font-size: 42;
color: #c4302b;
}
.icon-linkedin {
font-family: "icomoon";
/* content: "\eac9"; */
font-size: 42;
color: #0077B5;
}
但是,我意识到tap属性仅在Button组件上不适用于Label组件。关于将链接附加到我的图标字体有什么建议吗?