我尝试创建一个Dart单页面应用程序.
我创建了第一个custom-application
包含整个应用程序的自定义元素().它有一个容器,用于渲染视图.还有一个侧面导航,它将包含用户信息并在用户登录时进行更新.
我想在视图之间共享信息.如何定义全局变量custom-application
并能够与其他视图共享?
例如,当您启动应用程序时,您未经过身份验证.当您致电/ login(login-view
)时,您将拥有一个登录表单.我想,当您登录应用程序时,该custom-application
元素存储由嵌套视图加载的用户信息login-view
并更新侧导航.
有可能吗?
我正在发现ReactJS和material-ui(http://material-ui.com/).
我尝试为我的应用程序创建一个默认模板.我想在分离的组件中使用AppBar和LeftNav(在新版本的Drawer中重命名).
默认情况下,AppBar上有一个菜单按钮.我想用它来打开LeftNav,但我不知道如何调用我的LeftBarComponent组件函数来打开它.
我几乎了解如何在组件之间进行通信,但在我的情况下,我不知道如何做,因为没有关于它的文档.我知道打开LeftNav元素的唯一方法是使用LeftNav.toggle()
http://material-ui.com/#/components/left-nav
谢谢你的帮助.
Default.jsx
use strict';
var React = require('react');
var pageStore = require('../../stores/page');
var MainNavbar = require('../modules/navbar.jsx');
var LeftNavbar = require('../modules/leftbar.jsx');
var getState = function() {
return {
title: pageStore.get().title
};
};
var DefaultComponent = React.createClass({
mixins: [pageStore.mixin],
componentDidMount: function() {
pageStore.emitChange();
},
getInitialState: function() {
return getState();
},
render: function() {
return (
/* jshint ignore:start */
<div className="main-container">
<MainNavbar />
<LeftNavbar />
<div className="content">
{this.props.children}
</div>
</div>
/* jshint ignore:end …
Run Code Online (Sandbox Code Playgroud) 从打字稿开始,我尝试声明一个 Mongoose 模式,它看起来像这样:
User
{
name : { type: String, required: true },
...
credentials :
{
email : { type : String, required : true },
password : { type : String, required : true },
},
...
}
Run Code Online (Sandbox Code Playgroud)
我试过这个:
import { Document, Types, Schema, Model, model } from "mongoose";
export interface ICredentials
{
email?:string,
password?:string,
}
export interface IUser extends Document
{
name?:string;
credentials?:ICredentials;
}
export var UserSchema:Schema = new Schema
({
name : { type : String, …
Run Code Online (Sandbox Code Playgroud) 我需要列出驱动器特定文件夹中的所有文件。它正在工作,但并不像预期的那样。即使文件已被删除并放入垃圾箱,我也会获得此文件夹中文件的完整列表。
我怎样才能只获取真正位于该文件夹中的文件?
async listActiveSeries()
{
let _RESULT = null;
try
{
const auth = await this._makeClient();
const googleDriveClient = google.drive({ version: 'v3', auth });
const response = await googleDriveClient.files.list
({
pageSize: 150,
q: `'${ID_OF_THE_FOLDER}' in parents`
});
if(response && response.data && response.data.files)
{
_RESULT = response.data.files;
}
}
catch(ex)
{ console.log(ex); }
return _RESULT;
}
Run Code Online (Sandbox Code Playgroud)