小编Aru*_*ven的帖子

如何在react.js ES6中使用props设置状态

我想知道,如何使用ES6使用props参数设置状态

之前:

const MyComponent = React.createClass({
  getInitialState: function() {
    return {
      name: this.props.name || 'Initial data...'
    };
  }
});
Run Code Online (Sandbox Code Playgroud)

而现在我正在尝试这样做并且this.props不存在:

class MyComponent extends React.Component {
  constructor() {
    super()
      this.state = { name: this.props.name || 'Joseph Flowers' };
  }
}
Run Code Online (Sandbox Code Playgroud)

ecmascript-6 reactjs webpack

4
推荐指数
2
解决办法
1218
查看次数

CSS圈边框填充动画

我有一个css文件,可以完美地制作圆形边框填充动画.它的宽度和高度均为100px.但我只需要50px宽度和高度的圆圈与相同的动画.我尝试了很多次来最小化尺寸,但圆圈没有得到正确的动画修复.请帮我缩小这个圈子.我需要:根据附加的图像文件宽度-50px高度-50px边框大小 - 圆形边框填充样本图像

我的代码

#loading
{   
  width: 100px;  
  height: 100px;  
  margin: 30px auto;
  position: relative;
}

.outer-shadow, .inner-shadow
{
  z-index: 4;
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 100%;
  box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.inner-shadow 
{
  top: 50%;
  left: 50%;
  width: 80px;
  height: 80px;
  margin-left: -40px;
  margin-top: -40px;
  border-radius: 100%;
  background-color: #ffffff;
  box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.5);
}

.hold 
{
  position: absolute;
  width: 100%;
  height: 100%;
  clip: rect(0px, 100px, 100px, 50px); …
Run Code Online (Sandbox Code Playgroud)

css animation geometry border

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

如何将php数组索引设置为数组值...?

我从查询中得到了这个数组。

Array
(
    [0] => Array
        (
            [user_id] => 5
            [first_name] => Diyaa
            [profile_pic] => profile/user5.png
        )

    [1] => Array
        (
            [user_id] => 8
            [first_name] => Raj
            [profile_pic] => profile/user8.jpg
        )

    [2] => Array
        (
            [user_id] => 10
            [first_name] => Vanathi
            [profile_pic] => profile/user10.jpg
        )
)
Run Code Online (Sandbox Code Playgroud)

我需要将数组索引设置为如下所示的数组值( user_id):

Array
(
    [5] => Array
        (
            [user_id] => 5
            [first_name] => Diyaa
            [profile_pic] => profile/user5.png
        )

    [8] => Array
        (
            [user_id] => 8
            [first_name] => Raj
            [profile_pic] …
Run Code Online (Sandbox Code Playgroud)

php arrays indexing multidimensional-array

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

如何使用SQL Server设置"自动插入"外键值?

我创建了两个表,并在它们之间创建了一个关系.

students:

create table students
(
    [StudentId] NVARCHAR(50) NOT NULL PRIMARY KEY,
    [Name] NVARCHAR(50) NOT NULL
);
Run Code Online (Sandbox Code Playgroud)

studentprofile:

create table studentprofile
(
    [Id] INT NOT NULL PRIMARY KEY IDENTITY(1, 1),
    [StudentId] NVARCHAR(50) NOT NULL,
    [Address] NVARCHAR(50) NOT NULL,
);
Run Code Online (Sandbox Code Playgroud)

和关系:

alter table studentprofile
add constraint students_studentprofile_FK 
    foreign key (StudentId) 
    references students(StudentId) 
        on delete cascade on update cascade
Run Code Online (Sandbox Code Playgroud)

但是,当我写这行时:

insert into students values('110111', 'Marik')
Run Code Online (Sandbox Code Playgroud)

StudentId(表中studentprofile)的值未自动更新.为什么?

你能告诉我如何设置StudentId(在表格中studentprofile)的值可以在我插入表格时自动插入students吗?

sql-server foreign-keys primary-key

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