本文整理汇总了TypeScript中@dojo/widget-core/mixins/I18n.I18nMixin函数的典型用法代码示例。如果您正苦于以下问题:TypeScript I18nMixin函数的具体用法?TypeScript I18nMixin怎么用?TypeScript I18nMixin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了I18nMixin函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: I18nMixin
import { WidgetBase } from '@dojo/widget-core/WidgetBase';
import { WidgetProperties } from '@dojo/widget-core/interfaces';
import { ThemedMixin, theme } from '@dojo/widget-core/mixins/Themed';
import { v, w } from '@dojo/widget-core/d';
import { Link } from '@dojo/routing/Link';
import { I18nMixin } from '@dojo/widget-core/mixins/I18n';
import appBundle from '../nls/common';
import * as css from './styles/todoFilter.m.css';
export interface TodoFilterProperties extends WidgetProperties {
filter?: string;
}
export const TodoFilterBase = I18nMixin(ThemedMixin(WidgetBase));
@theme(css)
export class TodoFilter extends TodoFilterBase<TodoFilterProperties> {
render() {
const { filter } = this.properties;
const messages = this.localizeBundle(appBundle);
return v('ul', { classes: this.theme(css.filters) }, [
v('li', [
w(Link, {
key: 'all',
classes: this.theme(filter === 'all' ? css.selected : null),
to: 'view',
isOutlet: true,
params: { filter: 'all' }
示例2: I18nMixin
controls: string;
disabled?: boolean;
id: string;
index: number;
onClick?: (index: number) => void;
onCloseClick?: (index: number) => void;
onDownArrowPress?: () => void;
onEndPress?: () => void;
onFocusCalled?: () => void;
onHomePress?: () => void;
onLeftArrowPress?: () => void;
onRightArrowPress?: () => void;
onUpArrowPress?: () => void;
};
export const ThemedBase = I18nMixin(ThemedMixin(WidgetBase));
@theme(css)
export class TabButtonBase<P extends TabButtonProperties = TabButtonProperties> extends ThemedBase<P> {
private _onClick() {
const {
disabled,
index,
onClick
} = this.properties;
!disabled && onClick && onClick(index);
}
private _onCloseClick(event: MouseEvent) {
const {
示例3: I18nMixin
import { v } from '@dojo/widget-core/d';
import { I18nMixin } from '@dojo/widget-core/mixins/I18n';
import { ThemedMixin, theme } from '@dojo/widget-core/mixins/Themed';
import { WidgetBase } from '@dojo/widget-core/WidgetBase';
import { DNode, WidgetProperties } from '@dojo/widget-core/interfaces';
import appBundle from '../nls/common';
import * as css from './styles/credits.m.css';
const CreditsBase = I18nMixin(ThemedMixin(WidgetBase));
@theme(css)
export class Credits extends CreditsBase<WidgetProperties> {
protected render(): DNode[] {
const messages = this.localizeBundle(appBundle);
return [
v('footer', {
classes: this.theme(css.footer)
}, [
v('p', { innerHTML: messages.footerInstructions }),
v('p', { innerHTML: messages.footerCredits }),
v('p', { innerHTML: messages.footerPartOf })
])
];
}
}
export default Credits;
示例4: I18nMixin
import { v } from '@dojo/widget-core/d';
import { theme, ThemedMixin } from '@dojo/widget-core/mixins/Themed';
import { DNode } from '@dojo/widget-core/interfaces';
import { WidgetBase } from '@dojo/widget-core/WidgetBase';
import { I18nMixin } from '@dojo/widget-core/mixins/I18n';
import appBundle from '../nls/common';
import * as css from './styles/todoSearch.m.css';
export interface TodoSearchProperties {
search: (payload: { search: string }) => void;
searchValue: string;
}
export const TodoSearchBase = I18nMixin(ThemedMixin(WidgetBase));
@theme(css)
export class TodoSearch extends TodoSearchBase<TodoSearchProperties> {
protected onInput({ target: { value: search } }: any) {
this.properties.search({ search });
}
protected render(): DNode[] {
const { searchValue: value } = this.properties;
const messages = this.localizeBundle(appBundle);
return [
v('span', { classes: this.theme(css.searchIcon) }),
v('input', {
type: 'text',
示例5: I18nMixin
import { theme, ThemedMixin } from '@dojo/widget-core/mixins/Themed';
import { I18nMixin } from '@dojo/widget-core/mixins/I18n';
import appBundle from '../nls/common';
import * as css from './styles/todoHeader.m.css';
export interface TodoHeaderProperties {
allCompleted: boolean;
todo: string;
todoCount: number;
toggleTodos: (payload: object) => void;
addTodo: (payload: object) => void;
setCurrentTodo: (payload: { todo: string }) => void;
}
export const TodoHeaderBase = I18nMixin(ThemedMixin(WidgetBase));
@theme(css)
export class TodoHeader extends TodoHeaderBase<TodoHeaderProperties> {
protected toggleTodos() {
this.properties.toggleTodos({});
}
protected addTodo(event: KeyboardEvent) {
if (event.which === 13) {
this.properties.addTodo({});
}
}
protected setCurrentTodo({ target: { value: todo } }: any): void {