Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Riot seed 会一直保持一个Riot 2.2.4版本,这是最后一个宣称可兼容IE-8的release版本。并附带html5shim和es5shim。
Riot seed 会一直保持一个Riot 2.2.4版本,这是最后一个宣称可兼容IE-8的release版本。并附带html5shim和es5shim。
随着Riot版本更新,会有一个和最新版Riot保持基本同步的版本。
npm install riot-seed -g //全局安装,安装后可以通过命令行快速创建项目
riotseed foldername --ie //在当前目录创建基于2.2.4的IE兼容版本种子工程
riotseed foldername //在当前目录创建基于最新版本的种子工程(单页应用)
riotseed foldername --muti //在当前目录创建基于最新版本的种子工程(多页应用)
(当前版本采用的是shell脚本,无法在windows下运行)
项目创建成功后使用:
gulp : 监听.tag文件的变更,并启动静态server
gulp dist : 项目打包
第一步,使用flux.createStore(options) API创建store, 每一个store对应一个数据资源
var store = flux.createStore(options)
第二步, 数据的获取,options必须拥有一个get方法:
options.get = function(params) {
var self = this;
$.ajax({
...
data: params,
success: function(result) {
self.data = result.data; //把数据赋值给options.data
self.trigger('complete'); //options抛出'complete'事件
},
error: function(err) {
self.trigger('error'); ////错误时抛出'error'事件
}
})
}
第三步, 编写其他数据处理方法
options.unshift = function(params) {
if (isArray(this.data) && !isArray(params)) {
this.data.unshift(params);
}
if (isArray(options.data) && isArray(params)) {
this.data = params.concat(this.data);
}
this.trigger('complete'); //每次处理结束后都要抛出'complete'事件
}
第四步,将store和组件中的属性进行绑定
flux.bind.call(this, {
store: store,
name: 'data',
params: {id: 1},
refresh: true,
success: function() { //绑定成功后的回调 },
error: function() { //绑定失败后的回调, 需要在get方法中trigger('error')才会触发。 }
});
第五步,bind以后,在任何地方使用store.unshift(params); store.get(params);
等之前定义的方法来修改数据,那么跟这个数据资源相关的视图都会被修改。
在页面/组件中进行如下调用:
<app>
<route></route>
</app>
根据配置和url,会把对应的组件mount到对应的标签内 使用 riotRouter(options) 语法:
riotRouter({
'app': [
{ route: '/main', tag: 'chat', default: true },
{ route: '/login', tag: 'login'},
{ route: '/history', tag: 'history'},
{ route: '/count', tag: 'count'},
{ route: '/setting', tag: 'setting'},
{ route: '/admin', tag: 'admin'},
],
'history' : [
{ route: '/history/show', tag: 'history-show'},
{ route: '/history/:id', tag: 'history-detail'}
],
'count' : [
{route: '/count/pillar', tag: 'count-pillar'},
{route: '/count/pie', tag: 'count-pie'},
{route: '/count/brokenline', tag: 'count-brokenline'}
]
});
数组前的key是指父元素的选择器
*** riotRouter还可以对参数进行解析:***
使用riot.routeParams
进行获取。
例如我有如下路由:
'history' : [
{ route: '/history/:pid/:id', tag: 'history-detail'}
],
访问 #history/1/2
这样一个url的时候,访问riot.routeParams
可以获得:
{
pid: '1',
id: '2'
}
访问 #history/1/2?name=tom
这样一个url的时候,访问riot.routeParams
可以获得:
{
pid: '1',
id: '2',
name: 'tom'
}
FAQs
Riot seed 会一直保持一个Riot 2.2.4版本,这是最后一个宣称可兼容IE-8的release版本。并附带html5shim和es5shim。
We found that riot-seed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.