小编Dia*_*ond的帖子

将道具传递给素材UI样式

给出如下卡片代码: 卡片

如何更新卡片样式或任何材质UI样式

    const styles = theme => ({
    card: {
    minWidth: 275,
  },
Run Code Online (Sandbox Code Playgroud)

如下:

    const styles = theme => ({
    card: {
    minWidth: 275, backgroundColor: props.color  },
Run Code Online (Sandbox Code Playgroud)

当我尝试最新的那个时,我得到了

 Line 15:  'props' is not defined  no-undef
Run Code Online (Sandbox Code Playgroud)

当我更新代码时:

const styles = theme =>  (props) => ({
    card: {
    minWidth: 275, backgroundColor: props.color  },
Run Code Online (Sandbox Code Playgroud)

 const styles  = (theme ,props) => ({
        card: {
        minWidth: 275, backgroundColor: props.color  },
Run Code Online (Sandbox Code Playgroud)

代替

const styles = theme => ({
    card: {
    minWidth: 275, backgroundColor: props.color …
Run Code Online (Sandbox Code Playgroud)

reactjs material-ui

24
推荐指数
9
解决办法
2万
查看次数

在Angularjs中,如何在从中删除行后更新表数据

我使用angularjs来调用Asp.net Web API.从表中删除一行后?

我也没有在w3schools找到解决方案.

我的HTML代码

 <tr ng-repeat="user in users | filter: search">
     <td>{{ user.Id }}</td>
     <td>{{ user.FullName }}</td>
     <td>{{ user.Mobile }}</td>
     <td>{{ user.Birthdate }}</td>
     <td>{{ user.Gender }}</td>
     <td>{{ user.AcademicLevel }}</td>

     <td>
Run Code Online (Sandbox Code Playgroud)

我的Angularjs代码

$scope.DeleteUser = function (id) {
    UserID = $scope.users[id].Id;
    $http.delete('/api/users/' + UserID).success(function (data) {
       (function (data) {
        $scope.error = "error " + data;
    });

}
Run Code Online (Sandbox Code Playgroud)

我在Stackoverflow中搜索过,我发现其中一些不适合我的地方,他们让我很困惑.

$scope.refresh()
$scope.apply();
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-scope angularjs-ng-repeat

6
推荐指数
2
解决办法
3万
查看次数

如何使用MenuItem导航?material-ui V1

为什么不清楚MenuItem如何导航到其他路线?

例如,当点击菜单项时,我想路由到'/ account'

我可以设法使用onclick功能实现这一点,但我确信有一种更简单的方法.请告诉我,我想在我的项目中实现它.

顺便说一下,当使用containerElement时,containerElement={<Link to="/dashboard" />}我得到以下错误:

index.js:2177 Warning: React does not recognize the `containerElement` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `containerelement` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    in li (created by ButtonBase)
    in ButtonBase (created by withStyles(ButtonBase))
    in withStyles(ButtonBase) (created by ListItem)
    in ListItem (created by withStyles(ListItem))
    in …
Run Code Online (Sandbox Code Playgroud)

reactjs material-design material-ui

3
推荐指数
1
解决办法
3732
查看次数

react-select:覆盖默认样式并删除可清除的“x”图标

感谢您打开这个问题。我实现了react-select

            <Select
              searchable
              clearable
              name="form-field-name"
              options={options}
              value={this.state.value}
              onChange={this.onChange}
            /> 
Run Code Online (Sandbox Code Playgroud)

将页面更改为 时RTL,我padding-right在所选选项的开头有一些空格 ( )。随附的屏幕截图阐明了这一点。我试着添加

.has-value.is-clearable.Select--single > .Select-control .Select-value { padding-right: 10px; }

到我自己的 CSS 但这没有奏效。请帮我修复它。

另一个问题,清除文本的“x”我找不到删除它的方法,问题是它既不能清除文本也不能删除。我在有/没有searchable财产的情况下使用了两种方式。此外,由于返回了空值,因此单击时会生成错误(我使用控制台发现了这一点)。请看下面的截图。

在此处输入图片说明

css reactjs react-select

1
推荐指数
1
解决办法
4960
查看次数

为什么(undefined || false)表达式无法正常工作?

动作/ index.js

export const fetchAppointment = (userId) => async dispatch =>{
const request = await axios.get(`${URL}/apis/appointments/${userId}`)
    dispatch({type :types.FETCH_APPOINTMENT, payload:request.data})
Run Code Online (Sandbox Code Playgroud)

};

减速器/ reducer_appointment.js

import _ from 'lodash';
import * as types from '../actions/types';
export default function(state = null, action) {
    switch (action.type) {
        case types.FETCH_APPOINTMENT:
            return  _.mapKeys(action.payload, 'patients_id')  || false
        default:
            return state;
    }
}
Run Code Online (Sandbox Code Playgroud)

app.js

    renderAppointment(){
    console.log(this.props.appointment)
    switch(this.props.appointment){
    case null: 
        console.log("null case")
        return;
    case false:
        console.log("false case")
        return <div>false case</div>;
    default:
        console.log("default case")
         return <div>default case </div>;
    }
}
Run Code Online (Sandbox Code Playgroud)

问题我总是得到 …

javascript reactjs redux

0
推荐指数
1
解决办法
76
查看次数