启用捏放大图像标签

时间:2020-04-04 14:59:45

标签: nativescript

我想使捏放大图像,我从前一个视图加载上下文中传递的图像源,我尝试了一个插件https://github.com/triniwiz/nativescript-image-zoom,但是当我来时它有一个奇怪的行为从另一页开始,它显示上一张图像,然后显示下一页。因此,我认为如果有一种方法可以“启用”事件压缩区域并直接在标签img上平移, 这是我的代码,我使用纯js,在此版本中,页面内容中仅包含img标签,但它应该是GridLayout或StackLayout或插件标签,任何东西都可以帮助我吗?

<Page loaded="loaded" xmlns:shared="shared" xmlns:nsDrawer="nativescript-ui-sidedrawer" xmlns:ui="nativescript-image-zoom"
>
    <shared:actionbar></shared:actionbar>
    <nsDrawer:RadSideDrawer id="sideDrawer" showOverNavigation="true">
        <nsDrawer:RadSideDrawer.drawerContent>
            <shared:side-drawer></shared:side-drawer>
        </nsDrawer:RadSideDrawer.drawerContent>
        <nsDrawer:RadSideDrawer.mainContent>

                <Image src="{{ img }}"/>

        </nsDrawer:RadSideDrawer.mainContent>
    </nsDrawer:RadSideDrawer>
</Page>
let Observable = require("tns-core-modules/data/observable").Observable;
let moment = require('moment')
let LoadingIndicator = require("@nstudio/nativescript-loading-indicator").LoadingIndicator;
let loader = new LoadingIndicator();

moment.locale('it');

let pageData = new Observable();
let page;
let gotData;
exports.loaded = function (args) {
    loader.show();
    page = args.object;
    page.bindingContext = pageData;
    gotData = page.page.navigationContext;
    pageData.set("img", gotData.event.pictureUrl);
    loader.hide()
};

0 个答案:

没有答案