本文整理汇总了TypeScript中tns-core-modules/ui/core/view.Property类的典型用法代码示例。如果您正苦于以下问题:TypeScript Property类的具体用法?TypeScript Property怎么用?TypeScript Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Property类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
/// <reference path="./and-ts-lib/types.d.ts" />
import { WebImageCommon, srcProperty, isLoadingProperty } from './web-image-cache.common';
import { StretchMapping as stretchMap } from './and-ts-lib/stretch-mapping';
import { Helpers as helpers } from './and-ts-lib/helpers';
import * as application from 'tns-core-modules/application';
import * as appSettings from 'tns-core-modules/application-settings';
import { Property, booleanConverter } from 'tns-core-modules/ui/core/view';
let roundedProperty = new Property<WebImageCommon, boolean>({
name: "rounded",
defaultValue: false,
valueConverter: booleanConverter,
affectsLayout: true
}),
placeholderProperty = new Property<WebImageCommon, string>({
name: "placeholder",
defaultValue: undefined,
valueConverter: function(v) {
return v;
},
affectsLayout: true
}),
placeholderStretchProperty = new Property<WebImageCommon, string>({
name: "placeholderStretch",
defaultValue: stretchMap.get('none'),
valueConverter: function(v) {
return v;
},
affectsLayout: true
示例2: constructor
import { View, Property } from 'tns-core-modules/ui/core/view';
export class GifCommon extends View {
public src: string;
constructor() {
super();
}
}
export const srcProperty = new Property<GifCommon, string>({
name: 'src',
defaultValue: ''
});
srcProperty.register(GifCommon);
export const headersProperty = new Property<GifCommon, any>({
name: 'headers'
});
headersProperty.register(GifCommon);
export const isLoadingProperty = new Property<GifCommon, boolean>({
name: 'isLoading',
defaultValue: false
});
isLoadingProperty.register(GifCommon);
示例3:
import { Property, View } from 'tns-core-modules/ui/core/view';
import { Stretch } from 'tns-core-modules/ui/enums';
export const imageUriProperty = new Property<ImageCacheItBase, any>({
name: 'imageUri'
});
export const placeHolderProperty = new Property<ImageCacheItBase, string>({
name: 'placeHolder'
});
export const errorHolderProperty = new Property<ImageCacheItBase, string>({
name: 'errorHolder'
});
export const resizeProperty = new Property<ImageCacheItBase, string>({
name: 'resize'
});
export const stretchProperty = new Property<ImageCacheItBase, Stretch>({
name: 'stretch'
});
export class ImageCacheItBase extends View {
public imageUri: any;
public placeHolder: string;
public errorHolder: string;
public resize: string;
public stretch: Stretch;
}
export type Stretch = 'none' | 'fill' | 'aspectFill' | 'aspectFit';
imageUriProperty.register(ImageCacheItBase);
placeHolderProperty.register(ImageCacheItBase);
errorHolderProperty.register(ImageCacheItBase);
示例4: isAvailable
cameraPosition: CameraPositionType;
saveToGallery: boolean;
quality: Quality;
thumbnailCount: number;
fill: boolean;
public static isAvailable(): boolean {
return false;
}
public static requestPermissions(explanation?: string): Promise<any> {
return Promise.resolve();
}
}
export const fillProperty = new Property<AdvancedVideoViewBase, boolean>({
name: 'fill',
defaultValue: false
});
export const thumbnailCountProperty = new Property<AdvancedVideoViewBase, number>({
name: 'thumbnailCount',
defaultValue: 1
});
export const qualityProperty = new Property<AdvancedVideoViewBase, any>({
name: 'quality',
defaultValue: Quality.MAX_480P
});
export const cameraPositionProperty = new Property<AdvancedVideoViewBase,
CameraPositionType>({
name: 'cameraPosition',
defaultValue: 'back'
});
示例5: boolParse
export function boolParse(value: any) {
if (types.isString(value)) {
switch (value.toLowerCase()) {
case 'yes':
return true;
default:
return false;
}
} else if (types.isBoolean(value)) {
return value;
}
return false;
}
export const srcProperty = new Property<TNSPSPDFView, string>({
name: 'src'
});
export const documentTitleProperty = new Property<TNSPSPDFView, string>({
name: 'documentTitle'
});
export const selectedIndexProperty = new Property<TNSPSPDFView, number>({
name: 'selectedIndex',
defaultValue: 0
});
export class TNSPSPDFView extends View {
src: string;
progress: number;
documentTitle: string;
selectedIndex: number;
示例6: constructor
import { View, Property } from "tns-core-modules/ui/core/view";
import * as utils from "tns-core-modules/utils/utils";
import * as types from "tns-core-modules/utils/types"
// This is used for definition purposes only, it does not generate JavaScript for it.
import * as definition from "./svg";
var SRC = "src";
var IMAGE_SOURCE = "imageSource";
var LOAD_MODE = "loadMode";
var SYNC = "sync";
var ASYNC = "async";
var ISLOADING = "isLoading";
export const srcProperty = new Property<SVGImage, boolean>({ name: SRC, defaultValue: undefined, valueChanged: (target, oldValue, newValue) => target._createImageSourceFromSrc() });
export const imageSourceProperty = new Property<SVGImage, definition.ImageSourceSVG>({ name: IMAGE_SOURCE, defaultValue: undefined });
export const isLoadingProperty = new Property<SVGImage, boolean>({ name: ISLOADING, defaultValue: false });
export const loadModeProperty = new Property<SVGImage, string>({ name: LOAD_MODE, defaultValue: SYNC });
export class SVGImage extends View implements definition.SVGImage {
src: any;
imageSource: definition.ImageSourceSVG;
isLoading: boolean;
loadMode: "sync" | "async";
constructor(options?: definition.Options) {
// super(options);
super();
}
/**