小编a53*_*416的帖子

如何在 Twitter bootstrap sass (alpha 4) 中创建列

我正在尝试使用 SASS 提供的 make-col() mixin。http://v4-alpha.getbootstrap.com/layout/grid/。我想要做的是创建两列。有了编译好的类,我就可以做

我得到两个 div,它们以任何大于sm.

在 Bootstrap Sass 中(我在 React 中使用它),当我这样做时:

.row {
    @include make-row()
}
.left {
    @include make-col(3)
}
.right {
    @include make-col(9);
}
Run Code Online (Sandbox Code Playgroud)

它确实将两个浮动在一起,但是当我缩小屏幕时,两者不会被挡住。它们保持漂浮状态。使用 mixins 时,如何让 Bootstrap 镜像上述示例。

顺便说一句,从文档中:@mixin make-col($size, $columns: $grid-columns, $gutter: $grid-gutter-width)- 究竟是size什么?是列数吗?我很困惑,因为还有一个$columns变量。

css sass mixins twitter-bootstrap bootstrap-4

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

如何向 javascript 的 fetch() 函数发送额外数据

我想用来fetch()查询支持我的搜索页面的 API 端点。它以 JSON 格式返回搜索结果列表。

我还想将用户提交的当前查询传递给 API。旧的实现使用 jquery 和getJSON。查看 getJSON 的文档,它说我可以传入一个data变量:

数据
类型:普通对象或字符串
随请求发送到服务器的普通对象或字符串。

查看 fetch的文档,我不确定如何将数据作为我的请求的一部分传递。所以我的问题是,我如何传入一个将与我的请求一起发送到服务器的字符串?

编辑:我想我可以将查询附加到请求 URL,如“/search/?q=Something”并发送。有没有人有更好的方法?

javascript jquery json fetch-api

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

使用SQL和JOIN进行Tally投票(这可能吗?)

我的问题类似于我已经尝试过解决方案的问题,但这对我的情况来说并不完全正确.

我有2张桌子:投票和帖子.这是一个基本草图:

`posts`
----+------------------------------------------------------------------------+
| ID | post_title                                                            |
+----+-----------------------------------------------------------------------+
|  1 | Hello world.                                                          |
|  2 | This is a post!                                                       |
|  3 | What is the meaning of life?                                          |
|  4 | Looking for a good time?                                              |
+----+-----------------------------------------------------------------------

`votes`
+----+---------+
| ID | post_id | 
+----+---------+
|  1 |     1   |  
|  2 |     1   | 
|  3 |     1   |  
|  4 |     3   | 
|  5 |     3   |  
| …
Run Code Online (Sandbox Code Playgroud)

mysql sql database posts

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

如何在javascript中访问对象内部的对象

这是要返回的对象.

Object: 
    contributors_enabled: false
    created_at: "Sat Apr 18 02:20:51 +0000 2009"
    ...
    status: Object
    ...
    verified: false
Run Code Online (Sandbox Code Playgroud)

如您所见,有2个对象.父级,然后是名为"status"的对象.

在javascript中,如何访问"status"对象.

我试过object.status返回null.

真实代码:

function get_data( $id ) { 
    global $tmhOAuth; 
    $code = $tmhOAuth->request( 'POST', $tmhOAuth->url('1/users/lookup.json', ''), array( 'user_id' => $id ) );
    if ( $code == 200 ) {
        $data = json_decode($tmhOAuth->response['response'], true);
        return $data; 
    } else { 
        outputError($tmhOAuth);
    }   
} 

if ( !empty( $_POST ) && !is_null( $_POST ) ) { 
    extract( $_POST ); //imports $id; 
    $data = get_data($id); …
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery .post

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