本文整理汇总了TypeScript中mithril.render函数的典型用法代码示例。如果您正苦于以下问题:TypeScript render函数的具体用法?TypeScript render怎么用?TypeScript render使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const run = () => {
cells = cells === full ? empty : full;
m.render(root, [view()]);
setTimeout(run, 2000);
};
示例2: function
const run = function() {
cells = cells === full ? empty : full
m.render(root, [view()])
setTimeout(run, 2000)
}
示例3: handler
console.assert(vnode.children![0].tag === 'div');
}
{
const handler = m.withAttr("value", (value) => {});
handler({currentTarget: {value: 10}});
}
{
const params = m.parseQueryString("?a=1&b=2");
const query = m.buildQueryString({a: 1, b: 2});
}
{
const root = window.document.createElement("div");
m.render(root, m("div"));
console.assert(root.childNodes.length === 1);
}
{
const root = window.document.createElement("div");
m.mount(root, { view: () => m("div") });
console.assert(root.childNodes.length === 1);
console.assert(root.firstChild!.nodeName === "DIV");
}
{
const root = window.document.createElement("div");
m.route(root, "/a", {
"/a": { view: () => m("div") }
});
示例4: redraw
function redraw() {
m.render(mountPoint, Vnode(RouteComponent, undefined, undefined, undefined, undefined, undefined));
}
示例5: require
import { createEditor } from '../editor'
import { createPopupmenu } from '../popupmenu'
require('codemirror/addon/hint/show-hint.js')
require('codemirror/addon/search/searchcursor.js')
require('codemirror/addon/dialog/dialog.js')
require('codemirror/keymap/sublime.js')
require('codemirror/mode/sql/sql.js')
require('../../modules/sql-hint')
const pubsub = new EventEmitter()
const editor = createEditor(m, pubsub, CodeMirror)
const editorContainer = document.createElement('div')
document.body.appendChild(editorContainer)
m.render(editorContainer, editor.view())
describe('editor', () => {
it('should set value', () => {
editor.setValue('testing\nline2')
expect(editor.getValue(' ')).to.equal('testing line2')
})
it('should get the selected statement', () => {
editor.setValue('line1\nline2')
editor.setCursor({
line: 1,
ch: 0,
})
expect(editor.getCursorStatement(' ')).to.equal('line1 line2')
editor.setValue('line1\n\nline2')