本文整理匯總了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 {