Вставка ссылки на иконки шрифтов в Nativescript - PullRequest
0 голосов
/ 11 октября 2018

Я использую icomoon в качестве иконок для шрифтов.Я вставил значки в свое приложение, но теперь хочу прикрепить ссылку, чтобы открыть браузер.Я попытался использовать атрибут «tap» с функцией utils, чтобы открыть браузер следующим образом:

home-page.js file

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-file

<StackLayout orientation="horizontal" horizontalAlignment="center" width="auto" height="auto">
                             <Label text= "&#xea91;" class="icon-facebook" paddingTop = "30" tap="launch"/>                         
                             <Label text= "&#xea96;" class="icon-twitter"  paddingTop = "30" paddingLeft = "20" />
                             <Label text= "&#xea9d;" class="icon-youtube"  paddingTop = "30" paddingLeft = "20"/>
                             <Label text= "&#xeac9;" class="icon-linkedin" paddingTop = "30" paddingLeft = "20"/>
                            </StackLayout>

css-file

 .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 не работает с компонентом Label, а только с компонентом Button.Есть предложения по добавлению ссылок на мои иконки?

...