假设我想为我的用户提供数据提供程序元素,例如
<user-data-provider user-data="{{data}}"></user-data-provider>
Run Code Online (Sandbox Code Playgroud)
它发送一个ajax请求并获取登录用户.
假设我想在不同的页面中访问我的用户数据,并将此标记添加到我需要的任何地方,但问题是,每次浏览器看到此标记时,再次生成ajax,我必须等到获取数据!
我知道我可以在我的主页面中创建一个变量并将其传递给子页面,但这对我来说似乎有些过分!
如何在不同页面和部分应用程序中保留用户数据?
先感谢您
我的问题与react-admin仓库有关。
为了做到这一点,我想在组件范围之外分派一个动作,我读到我需要访问实际的redux存储本身,并直接在其中进行分派,
所以我知道该Admin组件具有一个initialStateprop,但是它仅接受默认状态对象,而不接受存储。因此,我无法建立商店并将其传递。
我的问题是:
Admin组件的redux存储?我当前的应用程序条目如下所示:
<AppLayoutDirection>
<Admin
title="My App"
locale="en"
dataProvider={dataProvider}
authProvider={authProvider}
i18nProvider={i18nProvider}
theme={themeProvider}
customSagas={customSagas}
appLayout={AppLayout}
>
{DynamicResource}
</Admin>
</AppLayoutDirection>
Run Code Online (Sandbox Code Playgroud) 有人有解决方法吗?我已经看到了其他答案,但似乎没有一个对我有用.
我可以运行其他项目 - 但是我当前的项目因上述错误而失败 - 因为没有明显的理由我能想到.Clean运行正常 - 没有代码错误 - 构建项目会导致这种情况.
我正在运行xcode 5 - 我已经尝试重新安装模拟器 - 重启我的机器 - 甚至我当前项目的备份 - 运行完美 - 现在得到了这个错误.
我对sql查询相当满意,但似乎无法集中精力进行mongo db文档的分组和求和,
考虑到这一点,我有一个具有以下模式的工作模型:
{
name: {
type: String,
required: true
},
info: String,
active: {
type: Boolean,
default: true
},
all_service: [
price: {
type: Number,
min: 0,
required: true
},
all_sub_item: [{
name: String,
price:{ // << -- this is the price I want to calculate
type: Number,
min: 0
},
owner: {
user_id: { // <<-- here is the filter I want to put
type: Schema.Types.ObjectId,
required: true
},
name: String,
...
}
}]
],
date_create: …Run Code Online (Sandbox Code Playgroud) mongoose mongodb node.js mongodb-query aggregation-framework
我正在将Vuetify用于 vue 应用程序,在这个文件中我看到了一个非常奇怪的语法,我找不到它是什么
在第 38 行:
const data = {
attrs: { disabled: this.disabled },
class: this.classes,
props: {},
directives: [{
name: 'ripple',
value: this.ripple || false
}],
on: {
...(this.$listeners || {}), // <<<---- here
click: this.click
}
}
Run Code Online (Sandbox Code Playgroud)
谁能说出那三个点是什么?任何关于这方面的文章都会很好
谢谢
我正在将使用 Material-ui 的 js 组件转换为打字稿,但遇到了问题。这部分正在渲染一个类似平铺的图像,其中组件道具被覆盖,加上道具的附加内容以形成正确的可点击链接。
我得到的错误是: TS2769:没有重载与此调用匹配。
这是我正在使用的代码:
导入语句:
import GridListTile from '@material-ui/core/GridListTile';
import { Link } from 'react-router-dom';
Run Code Online (Sandbox Code Playgroud)
在渲染函数中我有:
<GridListTile
component={Link} <<-- here I get the error
to={'/some-address'}
>
// other components
</GridListTile>
Run Code Online (Sandbox Code Playgroud)
我可以通过传递来消除错误as any,但随后它会抱怨支持!
<GridListTile
component={Link as any} <<-- won't complain
to={'/some-address'} <<-- but now here I get the error
>
// other components
</GridListTile>
Run Code Online (Sandbox Code Playgroud)
我希望能够使用 Material-ui 组件并能够传递另一个组件和我想要的道具。我遇到了一些黑客解决方案,处理这种情况的正确方法是什么?
javascript ×4
ajax ×1
ios7 ×1
mongodb ×1
mongoose ×1
node.js ×1
objective-c ×1
polymer ×1
react-admin ×1
react-redux ×1
reactjs ×1
redux ×1
typescript ×1
vuejs2 ×1
vuetify.js ×1
xcode ×1