问题标签 [ractive-load]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
141 浏览

components - 访问由 Ractive Load 创建的组件的实例

在组件内部,如果需要,我很乐意使用下面的语法来加载其他组件:

我的问题是,如何访问由Ractive Load在另一个组件中创建的示例组件实例?

重要的:

我可以定义主要组件的存储位置,我可以看到...anotherMainComponent.components.InternalExample但它似乎不是一个实例,因为我不能使用getset

相反,它似乎是要重用的“组件定义”(这对我来说很好)。

0 投票
1 回答
204 浏览

npm - 通过 Rollup 将 ractive 与 ractive-load 捆绑在一起

将ractiveractive-load导入到我的汇总项目的正确方法是什么?npm 还是 github?

目前我正在使用npm安装每个:

我正在使用rollup-plugin-commonjswithrollup-plugin-node-resolve来正确地捆绑它们(问题末尾的rollup.config.js):

但似乎 ractive-load 还在其代码中导入了其他模块,导致此错误:

Error parsing /home/.../node_modules/rcu/src/make.js: 'import' and 'export' may only appear at the top level (2:0) in /home/.../node_modules/rcu/src/make.js

我怎样才能正确使用 Rollup,哪些是这种情况下的正确来源(npm 或 github)?


这是我的rollup.config.js

0 投票
1 回答
184 浏览

ractivejs - 如何在 ractive 组件中加载外部 javascript 库?

我正在尝试对我的一些 html 页面进行组件化,以使它们成为 ractive 组件并使用 ractive-load 加载它们。我不使用任何构建系统或“工具”(即 grunt、browserify、require 等)

我收到错误消息:

索引.html

应用程序.js:

意见/控制.html:

如何将其他 JavaScript 库加载到 Ractive 组件中?