npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

component-placeholder-plugin

v1.0.17

Published

解决uni-app分包加载时无法实现component-placeholder组件占位符的问题

Downloads

43

Readme

component-placeholder-plugin

version plugin

解决问题

跨分包自定义组件引用

uni-app在分包加载的时候无法引用其他包的组件,而在原生小程序中是支持的,原生小程序支持componentPlaceholder属性,在uni-app中打包是不支持的。 因此可以通过本插件来解决。

使用方法

  1. 在根目录下创建vue.config.js文件

  2. vue.config.js引入插件component-placeholder-plugin

    const ComponentPlaceholderPlugin = require('component-placeholder-plugin')
    module.exports = {
        configureWebpack: {
            plugins: [
                new ComponentPlaceholderPlugin('/pages/businessComponents')
                // new ComponentPlaceholderPlugin(['/pages/businessComponents']) 可以写多个
            ]
        }
    }

    注意: ComponentPlaceholderPlugin可以传入一个分包列表,为分包组件的的根目录,不传的时候会替换所有usingsComponent与分包组件名相同的值,传则只替换与分包组件目录相同的值

  3. src/pages.json中新增配置项componentPlaceholder

    "pages": [
        {
            "path": "pages/index/index",
            "style": {
                "navigationBarTitleText": "uni-app"
            },
            "componentPlaceholder": {
                "points-mall": "view"
            }
        }
    ]

    或者放在pages.json的根目录下,与pages同级,在根目录下配置后,无需在子页面下配置componentPlaceholder。当然,子页面配置后的优先级更高,会替换根级配置的

    {
        "pages": [],
        "componentPlaceholder": {
            ...
        }
    }

    注意: 只需在你引用组件的根目录下配置组件占位符即可,无需具体到子页面,插件会递归地分析子页面的usingsComponent配置项,发现有引用到的占位符会自动加入componentPlaceholder中。组件名为kebab-case,与编译后的usingComponents保持一致。

联系方式

如使用中有任何问题,请联系[email protected],或者微信Ysx12340ShTx

license

MIT. Derived largely from node's assert module.