1.0.2 • Published 3 years ago

first-npm-practice v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

npm-practice

A vue-cpmps-npm project.

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production with minification
npm run build

使用方法

    #1.组件内部使用

        template:

            <Main/>

        js:

        import Main from 'first-npm-practice'

        components: {
        Main
        }

    #2.main.js 全局安装

        import Main from 'first-npm-practice'
        Vue.use(Main)
        然后在其他.vue文件里面,直接使用组件 <first-npm-practice/> 即可

    #3.直接引用打包后的 first-npm-practice.js

        这种方式就不需要webpack这类的构建工具,跟jquery的方式差不多,可以直接页面引用,使用方法示例如下:

        <!DOCTYPE html>
            <html lang="en">
            <head>
            <meta charset="utf-8">
            </head>
            <body>
            <div id="app">
            <first-npm-practice :propData="propData"></first-npm-practice>
            </div>
            <script src="https://unpkg.com/vue/dist/vue.js"></script>
            <script src="./dist/first-npm-practice.js"></script>
            <script>
            new Vue({
                el: '#app',
                data: function() {
                return {
                    propData: '11111111111111111111'
                }
                },
                methods: {
                }
            })
            </script>
            </body>
        </html>

For detailed explanation on how things work, consult the docs for vue-loader.

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago