@ecomplus/storefront-app

中文文档
2.0.0-beta.230发布于 2026/10/13MITCommonJS近 30 天下载 4322

Vue.js ecommerce app with cart, checkout and account pages

原始使用文档
文档目录6 节
  1. Installation
  2. With bundlers
  3. CDN
  4. Usage
  5. Manipulating cart items
  6. Manipulating customer account

Storefront App

npm version License MIT

Vue 2 SPA with cart, checkout and account pages for E-Com Plus Storefront:

CHANGELOG

Installation

You can install the package and import raw source when using bundlers such as Webpack and Browserify, or load compiled from CNDs like jsDelivr or UNPKG.

It requires and doesn't include @ecomplus/utils (peer dependency), it should be used to declare store settings before starting the checkout SPA, check the following examples and edit $ecomConfig.set with your store values.

Component styles will be loaded on demand, but Storefront Twbs styles should be previously imported for base UI.

With bundlers

npm i --save @ecomplus/utils @ecomplus/storefront-app
// config.js
import { $ecomConfig } from '@ecomplus/utils'
$ecomConfig.set('store_id', 1011)
$ecomConfig.set('lang', 'pt_br')
$ecomConfig.set('currency', 'BRL')
$ecomConfig.set('country_code', 'BR')
// checkout.js
import './config.js'
import '@ecomplus/storefront-app/src/main'
@import "node_modules/@ecomplus/storefront-twbs/scss/styles";

CDN

Add the scripts below right before </body> on your cart/checkout page:

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/utils@1/dist/ecom-utils.polyfill.min.js"></script>
<script>
  $ecomConfig.set('store_id', 1011);
  $ecomConfig.set('lang', 'pt_br');
  $ecomConfig.set('currency', 'BRL');
  $ecomConfig.set('country_code', 'BR');
</script>
<script src="https://cdn.jsdelivr.net/npm/@ecomplus/storefront-app@latest/dist/lib/js/app.js"></script>

And base UI styles before </head>:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ecomplus/storefront-twbs@5/dist/storefront-twbs.min.css">

Usage

You just need to have a #storefront-app element on your HTML:

<body>
  <main>
    <div id="storefront-app"></div>
  </main>
  <!-- scripts -->
</body>

Sample JSFiddle

We recommend running the SPA at the /app/ route (eg.: /app/index.html).

Manipulating cart items

You can import @ecomplus/shopping-cart on other ecommerce pages to add items before redirecting user to cart:

<script src="https://cdn.jsdelivr.net/npm/@ecomplus/shopping-cart@2/dist/ecom-cart.bundle.min.js"></script>
<script>
$('#buy-button').click(function () {
  // add item to cart
  ecomCart.addItem({
    product_id: '123a5432109876543210cdef',
    sku: 's-MP_2B4',
    name: 'Mens Pique Polo Shirt',
    quantity: 4,
    price: 42.9,
    picture: {
      normal: {
        url: 'https://samplecdn.x/mens-polo-350x350.webp'
      },
      zoom: {
        url: 'https://samplecdn.x/mens-polo.webp'
      }
    }
  });
  // redirect to checkout
  window.location.href = '/app/#/checkout';
})
</script>

For more details and examples, refer to EcomCart docs.

Manipulating customer account

Please refer to EcomPassport docs.

版本与发布记录

@ecomplus/storefront-app 共发布 322 个版本,首次发布于 2019/05/14;过去 12 个月发布了 8 个版本。

版本发布日期距今
2.0.0-beta.230latest2026/10/131 个月前
2.0.0-beta.2292026/09/231 个月前
2.0.0-beta.2282026/08/013 个月前
2.0.0-beta.2272026/07/074 个月前
2.0.0-beta.2262026/06/184 个月前
2.0.0-beta.2252026/02/178 个月前

其他发布通道:prerelease → 1.0.0-beta.33。

关于 @ecomplus/storefront-app 的常见问题

@ecomplus/storefront-app 是什么?

Vue.js ecommerce app with cart, checkout and account pages

如何安装 @ecomplus/storefront-app?

在项目目录运行 npm install @ecomplus/storefront-app,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@ecomplus/utils(^1.4.1)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@ecomplus/storefront-app 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/ecomplus__storefront-app 是否存在。

@ecomplus/storefront-app 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@ecomplus/storefront-app 可以商用吗?

@ecomplus/storefront-app 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ecomplus/storefront-app 的下载量有多少?

根据 npm 官方下载统计,@ecomplus/storefront-app 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,322 次,日均约 144 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ecomplus/storefront-app 还在维护吗?

最新版本 2.0.0-beta.230 发布于 2026/10/13(1 个月前);至今共发布 322 个版本,其中过去 12 个月发布了 8 个;首次发布于 2019/05/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。