本文整理汇总了TypeScript中tns-core-modules/ui/core/view.Property.register方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Property.register方法的具体用法?TypeScript Property.register怎么用?TypeScript Property.register使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tns-core-modules/ui/core/view.Property
的用法示例。
在下文中一共展示了Property.register方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
return v;
},
affectsLayout: true
}),
stretchProperty = new Property<WebImageCommon, string>({
name: "stretch",
defaultValue: stretchMap.get('none'),
valueConverter: function(v) {
return v;
},
affectsLayout: true
});
srcProperty.register(WebImageCommon);
isLoadingProperty.register(WebImageCommon);
roundedProperty.register(WebImageCommon);
placeholderStretchProperty.register(WebImageCommon);
stretchProperty.register(WebImageCommon);
placeholderProperty.register(WebImageCommon);
export class WebImage extends WebImageCommon {
public rounded: boolean;
public placeholder: string;
public placeholderStretch: string;
constructor() {
super();
}
public get android(): any {
示例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:
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);
resizeProperty.register(ImageCacheItBase);
stretchProperty.register(ImageCacheItBase);
示例4:
}
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'
});
export const saveToGalleryProperty = new Property<AdvancedVideoViewBase,
boolean>({
name: 'saveToGallery',
defaultValue: false
});
qualityProperty.register(AdvancedVideoViewBase);
cameraPositionProperty.register(AdvancedVideoViewBase);
saveToGalleryProperty.register(AdvancedVideoViewBase);
fillProperty.register(AdvancedVideoViewBase);
thumbnailCountProperty.register(AdvancedVideoViewBase);
示例5: if
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;
}
srcProperty.register(TNSPSPDFView);
documentTitleProperty.register(TNSPSPDFView);
selectedIndexProperty.register(TNSPSPDFView);
示例6: fromNativeSource
}
export function fromNativeSource(source: any): definition.ImageSourceSVG {
var image = new definition.ImageSourceSVG();
return image.setNativeSource(source) ? image : null;
}
export function fromUrl(url: string): definition.ImageSourceSVG {
var image = new definition.ImageSourceSVG();
return image.loadFromUrl(url) ? image : null;
}
export function fromFileOrResource(path: string): definition.ImageSourceSVG {
if (!isFileOrResourcePath(path)) {
throw new Error("Path \"" + "\" is not a valid file or resource.");
}
if (path.indexOf(utils.RESOURCE_PREFIX) === 0) {
return fromResource(path.substr(utils.RESOURCE_PREFIX.length));
}
return fromFile(path);
}
export function isFileOrResourcePath(path: string): boolean {
return utils.isFileOrResourcePath(path);
}
srcProperty.register(SVGImage);
imageSourceProperty.register(SVGImage);
loadModeProperty.register(SVGImage);
isLoadingProperty.register(SVGImage);