小编Mih*_*lcu的帖子

在角应用中使用prismjs

我正试图在我的角度应用程序中使用prismjs
这是我到目前为止所得到的

app.directive('nagPrism', [function() {
    return {
        restrict: 'A',
        transclude: true,
        scope: {
            source: '='
        },
        link: function(scope, element, attrs, controller, transclude) {
            if(!scope.source) {
                transclude(function(clone) {
                    element.html(clone);
                    Prism.highlightElement(element.find("code")[0]);
                });
            } else {
                scope.$watch(function() {return scope.source;}, function(v) {
                    if(v) {
                        Prism.highlightElement(element.find("code")[0]);
                    }
                });
            }

        },
        template: "<code ng-bind='source'></code>"
    };

}]);
Run Code Online (Sandbox Code Playgroud)

如果我有这样的东西,这将有效

<!-- This works  -->
<pre nag-prism source="code" class="language-css"></pre>
Run Code Online (Sandbox Code Playgroud)

但我想让它也适合这样的事情

<pre nag-prism class="language-css">
<code>body {
color: red; 
}
  {{code}}

</code>
</pre>
Run Code Online (Sandbox Code Playgroud)

为方便起见,我做了一个plunkr
任何提示?

javascript angularjs angularjs-directive

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

win32按钮持续闪烁

我在win32 c ++上做了一个小游戏,可以正常工作,但是我有些按钮闪烁的问题。我猜想这与我经常发送WN_PAINT的事实有关。

InvalidateRect(hwnd, NULL, false);
UpdateWindow(hwnd);
Run Code Online (Sandbox Code Playgroud)

我这样用CreateWindow()制作了按钮

CreateWindow(TEXT("button"),  TEXT(BTN_SAVE), WS_VISIBLE | WS_CHILD, 
            client.right - offset[1] - 170, client.bottom - offset[3], 
            80, 25, hwnd, (HMENU)ID_BTN_SAVE, NULL, NULL);
Run Code Online (Sandbox Code Playgroud)

有人遇到过这个问题吗?有什么办法可以解决?

c++ winapi button visual-studio-2010

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