Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Cubeshop 是一个基于 Web Components 的跨框架 UI 组件库,输出标准的 Custom Element,组件可以同时在 React、Vue、Preact、Angular 或 原生 JS 等任意框架或无框架中使用。
我是使用者 developer | 我是开发者 user
具体安装使用方法请参考 Cubeshop 官网 https://allan2coder.github.io/cubeshop
<script type="module" src="https://unpkg.com/cubeshop"></script>
// 或
<script type="module" src="https://cdn.jsdelivr.net/npm/cubeshop"></script>
npm install cubeshop // or yarn add cubeshop
babel.config.js 添加如下配置, 依赖 babel-plugin-import
插件
plugins: [
['import', {
libraryName: 'cubeshop',
libraryDirectory: 'lib',
}, 'cubeshop']
]
import { CSButton, WCUse } from 'cubeshop'
WCUse(CSButton)
<cs-button type="primary">button</cs-button>
import 'cubeshop';
当作原生 dom 元素直接使用即可。
<template>
<div>
<cs-button type="primary">按钮</cs-button>
</div>
</template>
class Demo extends React.Component {
render() {
return (
<div>
<cs-button type="primary">按钮</cs-button>
</div>
);
}
}
Vue 工程中使用组件可能会出现告警
Unknown custom element
<!-- vue2: -->
Unknown custom element: <cs-card> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
<!-- vue3 -->
[Vue warn]: Failed to resolve component: cs-icon
别急,请在工程中注入如下代码即可:
// VUE2.x
Vue.config.ignoredElements = [/^cs-/]
// VUE3.x
// https://v3.cn.vuejs.org/guide/migration/global-api.html#config-productiontip-%E7%A7%BB%E9%99%A4
const app = createApp({})
app.config.compilerOptions.isCustomElement = tag => tag.startsWith('cs-')
如果您使用的是 vite,修改 vite.config.js:
import vue from '@vitejs/plugin-vue'
export default {
plugins: [
vue({
template: {
compilerOptions: {
isCustomElement: tag => tag === 'cs-'
}
}
})
]
}
cubeshop is released under the MIT License. See the bundled LICENSE file for details.
FAQs
Mobile UI Components built on Web Components.
The npm package cubeshop receives a total of 0 weekly downloads. As such, cubeshop popularity was classified as not popular.
We found that cubeshop demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.