在一个项目中,我们有多个 Dialog。现在,我想为 DialogOption 设置相同的全局变量。
我发现:https : //material.angular.io/components/dialog/overview 和这段代码:
@NgModule({
providers: [
{provide: MAT_DIALOG_DEFAULT_OPTIONS, useValue: {hasBackdrop: false}}
]
})
Run Code Online (Sandbox Code Playgroud)
我将这些代码与其他代码一起应用,但它不起作用。根本不应用这些设置。
有人让这些设置工作吗?
heroku run rails console
? heroku-cli: update available from 6.11.17 to 6.14.16-9ae58fc
? No app specified
Run Code Online (Sandbox Code Playgroud)
如何更新我的heroku-cli版本?
我正在创建一个有角度的应用程序,并且有带有复选框的项目。当用户单击复选框时,我会将选中的项目记录到对象中。该对象看起来像这样:
{1: false, 7: true, 8: true};
Run Code Online (Sandbox Code Playgroud)
When a user clicks on the delete button I need to get only selected items ids.
So I need to filter objects by values and as a result, get an array of integers.
I tried the following code with the lodash library:
console.log(_.pick(this.selectedItems, _.identity));
return _.pick(this.selectedItems, function (value, key) {
return value;
});
Run Code Online (Sandbox Code Playgroud)
But this returns an empty array.
What I need to get is an array [7,8]
What is wrong with my …
存储用户登录数据(主要是用户名或 uuid)的最佳且安全的方法是什么。那么,我可以在其他组件中使用它吗?我想了几种方法来做到这一点。
我的 authLogin 方法:
export const authLogin = (email, password) => {
return dispatch =>{
dispatch(authStart());
axios.post('http://127.0.0.1:8000/rest-auth/login/',{
email: email,
password: password,
})
.then(res => {
const token = res.data.key;
const expirationDate = new Date(new Date().getTime() + 3600 * 1000);
localStorage.setItem('token',token);
localStorage.setItem('expirationDate',expirationDate)
localStorage.setItem('email', email)#method 1
console.log("My token",localStorage.getItem('token'))
dispatch(authSuccess(token,email));#method 2
dispatch(checkAuthTimeout(3600));
})
.catch(err => {
dispatch(authFail(err))
})
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用react-picky包来显示带有typescript的选择过滤器选项,您可以检查以下package.json的版本。当我在没有打字稿的情况下使用 create-react-app 时,一切正常。也许某些库发生了冲突。我尝试过更新react和react-dom,即使它显示与我所附图像相同的错误。这不是一个进出口问题。我已经尝试了所有导入导出的方法。
{
"name": "user-portal-client",
"version": "1.0.0",
"description": "Front-end code for the Coinstash user portal.",
"scripts": {
"start": "webpack-dev-server --open",
"start:headless": "webpack-dev-server --host 0.0.0.0 --port 5000 --watch-poll",
"build": "webpack --config webpack.config.prod.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/classnames": "^2.2.7",
"@types/history": "^4.7.0",
"@types/react": "^16.4.18",
"@types/react-dom": "^16.0.9",
"@types/react-modal": "^3.8.1",
"@types/react-places-autocomplete": "^7.2.3",
"@types/react-router-dom": "^4.3.1",
"@types/react-share": "^2.1.1",
"@types/react-sidebar": "^3.0.0",
"@types/socket.io-client": "^1.4.32",
"@types/styled-components": "4.1.8",
"@types/url-join": "^4.0.0",
"awesome-typescript-loader": "^5.2.1",
"copy-webpack-plugin": "^4.4.2",
"source-map-loader": "^0.2.4",
"styled-components": "^4.2.0",
"ts-node": …Run Code Online (Sandbox Code Playgroud) 我正在尝试制作一个 python 脚本来在一个每天都有条目的 excel 文件中创建条目。我想检查一个文件是否存在然后打开它。如果文件不存在,那么我想创建一个新文件。
if have used os path exists 查看文件是否存在
workbook_status = os.path.exists("/log/"+workbookname+".xlxs")
if workbook_status = "True":
# i want to open the file
Else:
#i want to create a new file
Run Code Online (Sandbox Code Playgroud)