Tag: riot.js

循环内的防暴标签

我有一个xxx组件,当它与riot-tag属性和一个标准的HTML5标签一起使用时,它可以正常工作: <article riot-tag="xxx"></article> 。 但是,当我在循环中使用riot-tag属性时,标签是空的: <article each="{xxxTags}" riot-tag="{xxx}"></article> 。 在一个循环中是否可以使用riot-tag ? 我怎样才能使它工作? 附加说明: 我必须逐个生成几个不同的,尽pipe相似的组件。 所以我有一个数组来存储它们: var xxxTags = [{tag: 'xxx'}, {tag: 'yyy'}, {tag: 'zzz'}]; 把xxx , yyy , zzz中的任何一个textareas都手动一个接一个地手工运行,并生成相应的组件。 但是,当我试图做到这一点,他们最终在铬devtools空(没有孩子),但其他手动放置相同。 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JS Bin</title> </head> <body> <my-tag></my-tag> <!– inlined tag definition –> <script type="riot/tag"> <my-tag> /*Standard, manual addition of different components […]

服务器端渲染+ Riot.js路由?

我正在使用Node + Riot.js + Grapnel路由库(可以在客户端和服务器上工作)。 我pipe理如何在客户端上设置路由,但我无法确定如何使其在服务器上工作。 我的客户端路由器的当前function很简单。 我只是发送opts.route到适当的组件,然后它挂载请求的页面(这也是一个组件)到一个div 。 <x-layout> <div id="app-body"></div> <script> this.on('mount update', function() { riot.mount('#app-body', 'x-page-' + opts.route); }); </script> </x-layout> 但是使用riot.render(tag, {page: 'dashboard'})它不会将<x-page-dashboard>装载到#app-body 。 当我删除this.on('mount update' …包装它给了我一个错误 …/node_modules/riot/riot.js:1918 TypeError: (ctx || document).querySelectorAll is not a function` 这是显而易见的,因为Node不能执行DOM操作。 我也尝试dynamic加载组件,像这样 // Riot doesn't compiles such expressions `<x-page-{opts.route}>` var tag = riot.tag2('x-layout', '<div id="app-body"><x-page-{opts.route}></x-page-{opts.route}></div>'); […]

riotts(riot-ts)和jspm – 任何人都可以一起工作?

我一直在看这个雄心勃勃的项目https://github.com/nippur72/RiotTS ,已经把骚乱转移到暴乱。 作者已经使用了鲍尔,我试图让它使用jspm工作。 riot-ts不存在于jspm回购列表中,所以我使用jspm install npm:riot-ts导入jspm install npm:riot-ts 的package.json: { "jspm": { "directories": { "baseURL": "public/assets" }, "dependencies": { "riot-ts": "npm:riot-ts@^1.0.14" }, "devDependencies": { "babel": "npm:babel-core@^5.8.24", "babel-runtime": "npm:babel-runtime@^5.8.24", "core-js": "npm:core-js@^1.1.4" } }, "devDependencies": { "elixir-jasmine": "0.0.4", "gulp": "^3.9.1", "jspm": "^0.16.35", "laravel-elixir": "^6.0.0-2", "laravel-elixir-browsersync": "^0.1.5", "ws-laravel-elixir-typescript": "git+https://github.com/we-studio/laravel-elixir-typescript.git" }, "dependencies": { "bootstrap": "^4.0.0-alpha.2" } } SystemJSconfiguration(为简洁起见,省略了一些文件): System.config({ […]

如何从Node.js express服务器返回JSON数据到Riot.js?

我正在开发一个Web应用程序,在客户端使用Riot.js,在服务器端使用Node.js。 Riot.js可以挂载JSON数据并可以用于呈现HTML。 其实我有服务器端的一些JSON数据,并希望与Riot.js使用它们。 目前我的快递服务器的代码很简单。 var express = require('express'), serveIndex = require('serve-index'), app = express(); app.use(express.static(__dirname + '/public')); app.use(serveIndex(__dirname + '/public')); app.listen(3000); 我认为HTML模板对我的问题很有帮助。 但是我找不到Riot.js的答案,我如何使用和渲染来自服务器的数据? Node&Express – 如何在单个请求中向浏览器发送页面和一些JS数据? 我知道我是如何装载数据,如果数据在客户端这样的: <script> riot.mount('my_hoge', { data: [ { name: 'A', url: 'xxxx'}, { name: 'B', url: 'yyy', isActive: true}, { name: 'C', url: 'zzzz'} ] }) </script> 环境 Node.js v5.3.0 […]