在riot.js中使用路由器时如何使用库?

时间:2016-11-27 11:49:19

标签: riot.js

我正在用riot.js开发我的应用程序,我想使用dropzone(http://www.dropzonejs.com/)。

在我的代码中:

下面的index.html,



<!doctype html>
<html>

<head>
  <meta charset="utf-8">
</head>

<body>
  <app></app>
  <script src="dist/scripts/bundle.js"></script>
</body>

</html>
&#13;
&#13;
&#13;

下面的app.tag,

&#13;
&#13;
var route = require('riot-route'); require("dropzone"); require('./main/home.tag'); require('./main/contents1.tag');

<app>
  <main>
    <contents></contents>
  </main>
  <script>
    route(function(tagName) {
      tagName = tagName || 'home'
      riot.mount('contents', tagName)
    })
     route.start(true)
  </script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/min/dropzone.min.css" />
</app>
&#13;
&#13;
&#13;

下面的home.tag,

&#13;
&#13;
<home>
  <div class="search-box"></div>
</home>
&#13;
&#13;
&#13;

然后,我将<form action="/file-upload" class="dropzone" id="my-awesome-dropzone"></form>添加到这样的app.tag中,它运作正常。

&#13;
&#13;
<contents></contents>
<form action="/file-upload" class="dropzone" id="my-awesome-dropzone"></form>
&#13;
&#13;
&#13;

但是,我把它添加到home.tag中就像这样,

&#13;
&#13;
<home>
  <div class="search-box"></div>
  <form action="/file-upload" class="dropzone" id="my-awesome-dropzone"></form>
</home>
&#13;
&#13;
&#13;

它没有用。谁能帮我??

1 个答案:

答案 0 :(得分:1)

尝试在安装标签时更新DropZone,使用on('mount',或者也可以尝试on('updated',

Select t.*
From t
Where t.price = (select min(t2.price) from t t2 where t2.artickeid = t.articleid)