【问题标题】:ZK + component jar static resourcesZK+组件jar静态资源
【发布时间】:2015-01-19 04:24:36
【问题描述】:

我正在使用 ZK 框架并创建了一个自定义组件的 maven 项目。

我正在尝试根据此页面上的简要大纲为项目(对于没有 javascript 的组件)包含静态 CSS:

http://books.zkoss.org/wiki/ZK_Component_Development_Essentials/Packing_as_a_Jar

zk 是如何知道将项目包含在 ZK WEB 项目中时生成的 CSS 包含在内的?目前我的组件项目的资源目录如下所示:

web
    foo
         bar
            css
               zk.wcs
               macro.css.dsp
               other.css.dsp
            less
               macro.less
               other.less  

我的 zk.wcs :

<css language="xul/html">
    <stylesheet href="~./foo/bar/css/macro.css.dsp"/>
    <stylesheet href="~./foo/bar/css/primitive.css.dsp"/>
</css>

但是,在我的 web zk 项目中使用组件项目时,我在 macro.css.dsp 中的样式没有应用...

【问题讨论】:

    标签: zk


    【解决方案1】:

    您可以在 lang-addon.xml 中包含 css:

    <!-- define a component -->
    <component>
        <!-- the tag name of this component
            required,
            must be unique -->
        <component-name>codemirror</component-name>
        <!-- fully-qualified java class name at server side
            required for a new component that not extends another component -->
        <component-class>org.sinnlabs.zk.ui.CodeMirror</component-class>
        <!-- widget class, 'org.sinnlabs.zk.ui.CodeMirror' also specify the
            package of widget class 'org.sinnlabs.zk.ui'
            required for a new component that not extends another component -->
    
        <widget-class>org.sinnlabs.zk.ui.CodeMirrorWidget</widget-class>
        <!-- mold
            required for a new component that not extends another component
            or has self widget-class
    
            a mold denotes the files that to render and style this comopnent -->
        <mold>
            <!-- default mold is required -->
            <mold-name>default</mold-name>
            <!-- relative path based on widget-class' path
                (web/js/org/sinnlabs/zk/ui/)
    
                where codemirrorwidget.js (required) contains a function that
                will render the html of the comopnent. -->
            <mold-uri>mold/codemirrorwidget.js</mold-uri>
            <css-uri>css/codemirror.css</css-uri>
        </mold>
    </component>
    

    zk.load 将加载您的 css 样式。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-01-16
    • 1970-01-01
    • 1970-01-01
    • 2016-11-04
    • 1970-01-01
    • 2022-12-04
    • 2014-10-02
    相关资源
    最近更新 更多