小编Tom*_*tam的帖子

Angular2指令:如何检测DOM更改

我想将Skrollr实现为Angular2属性指令.

因此,格式可能是:

<body my-skrollr>
</body>
Run Code Online (Sandbox Code Playgroud)

但是,为了实现这一点,我需要能够检测包含标记(在本例中为<body>)下面的子元素中DOM的更改,以便我可以调用skrollr.init().refresh() ; 并更新库以使用新内容.

是否有一种直截了当的做法,我不知道,或者我是否接近这个错误?

javascript dom typescript skrollr angular

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

更新架构而不删除 mongodb 中的集合

我的架构如下所示:

const UserSchema = Schema({
    _id: mongoose.Schema.Types.ObjectId,
    userName: {
        type: String,
        required: true,
    },
    userPhoneNumber: {
        type: String,
    },
    role:[{
        type:mongoose.Schema.Types.ObjectId,
        ref:Role
    }]
});
Run Code Online (Sandbox Code Playgroud)

通过这个模式,我在数据库中添加了文档role:[]。但现在根据要求,我需要更新架构而不删除现有集合。我需要更新数据,除了角色之外,所有字段都相同。我想将现有记录更新为角色

const UserSchema = Schema({
    _id: mongoose.Schema.Types.ObjectId,
    userName: {
        type: String,
        required: true,
    },
    userPhoneNumber: {
        type: String,
    },
    role:[{
        type:mongoose.Schema.Types.ObjectId,
        ref:Role
    }]
});
Run Code Online (Sandbox Code Playgroud)

那么如何在不删除集合的情况下更新架构。

schema mongoose mongodb node.js

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

CGAL:从表面网格获取面数据

我正在尝试使用从 CGAL::Surface_mesh 检索到的数据填充我自己的结构。

您可以通过以下方式将面添加到表面网格中:

CGAL::SM_Face_index face = SM_Surface_Mesh.add_face(SM_Vertex_Index, SM_Vertex_Index, SM_Vertex_Index);
Run Code Online (Sandbox Code Playgroud)

..但是如何在给定 SM_Face_Index 的情况下检索该面孔呢?我尝试过筛选文档,但无济于事。

InteropMesh * outputMesh = new InteropMesh();
uint32_t num = mesh1.number_of_vertices();

outputMesh->vertexCount = num;

outputMesh->vertices = new InteropVector3[num];

for (Mesh::Vertex_index vd : mesh1.vertices()) 
{
    uint32_t index = vd; //via size_t

    Point data = mesh1.point(vd);
    outputMesh->vertices[index].x = (float)data.x();
    outputMesh->vertices[index].y = (float)data.y();
    outputMesh->vertices[index].z = (float)data.z();
}

outputMesh->indices = new uint32_t[mesh1.number_of_faces() * 3];

for (CGAL::SM_Face_index fd : mesh1.faces())
{
    //? How do I get the three vertex indices?
}
Run Code Online (Sandbox Code Playgroud)

c++ cgal

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

标签 统计

angular ×1

c++ ×1

cgal ×1

dom ×1

javascript ×1

mongodb ×1

mongoose ×1

node.js ×1

schema ×1

skrollr ×1

typescript ×1