Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 流星不';为什么不能在包内加载模板?_Javascript_Meteor_Meteor Autoform - Fatal编程技术网

Javascript 流星不';为什么不能在包内加载模板?

Javascript 流星不';为什么不能在包内加载模板?,javascript,meteor,meteor-autoform,Javascript,Meteor,Meteor Autoform,我花了很长时间试图弄清楚为什么包中的模板(autoform lightstar.html)没有加载,而如果我复制并粘贴到我的主文件meteor sample.html,一切正常 我刚刚发布了这个包(githubrepo:) meteor-sample.html: <head> <title>meteor-sample</title> </head> <body> <div> {{#each data}}

我花了很长时间试图弄清楚为什么包中的模板(
autoform lightstar.html
)没有加载,而如果我复制并粘贴到我的主文件
meteor sample.html
,一切正常

我刚刚发布了这个包(githubrepo:)


meteor-sample.html:

<head>
  <title>meteor-sample</title>
</head>

<body>
  <div>
  {{#each data}}
    {{star}}
  {{/each}}
  </div>
  {{> insertDataForm}}
</body>

<template name="insertDataForm">
  {{#autoForm collection="Data" id="insertDataForm" type="insert"}}
    <fieldset>
      <legend>Add Stuff</legend>
      {{> afQuickField name='star'}}
    </fieldset>
    <button type="submit" class="btn btn-primary">Insert</button>
  {{/autoForm}}
</template>

packages/autoform lightstar/package.js:

Package.describe({
  summary: 'AutoForm input type for light star rating',
  version: '0.0.1',
  name: 'geeksys:autoform-lightstar',
  git: 'https://github.com/geeksys/autoform-lightstar.git',
  documentation: null
});

Package.onUse(function(api) {
  api.versionsFrom('1.1.0.2');
  api.use([
    'aldeed:autoform@5.0.0',
    'templating@1.0.0'
  ]);

  api.addFiles([
    'images/star-off.svg',
    'images/star-on.svg',
    'autoform-lightstar.css',
    'autoform-lightstar.js',
    'autoform-lightstar.html'
  ], 'client');
});

软件包/autoform-lightstar/autoform-lightstar.html:

<template name="afLightStar">
  <div class="af-lightstar" {{dsk}}>
    {{#each this.items}}
        <input type="radio" id="{{this._id}}" value={{this.value}} {{atts}}>
        <label for="{{this._id}}">{{this.label}}</label>
    {{/each}}
  </div>
</template>

软件包/autoform lightstar/images/star-off.svg:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
  <path fill="#fff" stroke="#ccc" d="M 12,2.5 14.4,9.5 21.5,9.5 15.8,13.75 18.5,21.5 12,16.625 5.5,21.5 8.2,13.75 2.5,9.5 9.6,9.5 z"/>
</svg>


软件包/autoform lightstar/images/star-on.svg:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
  <path fill="#ffd700" stroke="#ccac00" d="M 12,2.5 14.4,9.5 21.5,9.5 15.8,13.75 18.5,21.5 12,16.625 5.5,21.5 8.2,13.75 2.5,9.5 9.6,9.5 z"/>
</svg>

感谢您的帮助。

更改以下订单:

api.addFiles([
    'images/star-off.svg',
    'images/star-on.svg',
    'autoform-lightstar.css',
    'autoform-lightstar.js',
    'autoform-lightstar.html'
  ], 'client');

已解决问题

没有错误,没有文档,通过纯粹的尝试和错误解决,我喜欢这个

.af-lightstar:not(old){
  display        : inline-block;
  width          : 7.5em;
  height         : 1.5em;
  overflow       : hidden;
  vertical-align : bottom;
}

.af-lightstar:not(old) > input{
  margin-right : -100%;
  opacity      : 0;
}

.af-lightstar:not(old) > label{
  display         : block;
  float           : right;
  position        : relative;
  background      : url('/packages/geeksys_autoform-lightstar/images/star-off.svg');
  background-size : contain;
}

.af-lightstar:not(old) > label:before{
  content         : '';
  display         : block;
  width           : 1.5em;
  height          : 1.5em;
  background      : url('/packages/geeksys_autoform-lightstar/images/star-on.svg');
  background-size : contain;
  opacity         : 0;
  transition      : opacity 0.2s linear;
}

.af-lightstar:not(old) > label:hover:before,
.af-lightstar:not(old) > label:hover ~ label:before,
.af-lightstar:not(:hover) > :checked ~ label:before{
  opacity : 1;
}
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
  <path fill="#fff" stroke="#ccc" d="M 12,2.5 14.4,9.5 21.5,9.5 15.8,13.75 18.5,21.5 12,16.625 5.5,21.5 8.2,13.75 2.5,9.5 9.6,9.5 z"/>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
  <path fill="#ffd700" stroke="#ccac00" d="M 12,2.5 14.4,9.5 21.5,9.5 15.8,13.75 18.5,21.5 12,16.625 5.5,21.5 8.2,13.75 2.5,9.5 9.6,9.5 z"/>
</svg>
api.addFiles([
    'images/star-off.svg',
    'images/star-on.svg',
    'autoform-lightstar.css',
    'autoform-lightstar.js',
    'autoform-lightstar.html'
  ], 'client');
api.addFiles([
    'images/star-off.svg',
    'images/star-on.svg',
    'autoform-lightstar.css',
    'autoform-lightstar.html',
    'autoform-lightstar.js'
  ], 'client');