Git Product home page Git Product logo

newbeea / universal-vue-component-template Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 181 KB

Building Universal Vue Libraries for Vue2 & Vue3. Using vue-demi but you don't need to write "render" function, "template" and "tsx" are supported!

Home Page: https://universal-vue-component-2.vercel.app

HTML 5.50% JavaScript 15.06% Vue 35.03% TypeScript 41.98% SCSS 2.43%
universal-components library vue2vue3 jsx tsx template

universal-vue-component-template's Introduction

Universal vue component template

  • Building Universal Vue Libraries for Vue 2 & 3
  • Using vue-demi but you don't need to write "render" function, "template" and "tsx" are supported!

Usage

Use this template or clone it

Install

yarn

Develop

yarn run dev

Build

yarn run build

Publish

Change package name, publish and install it to test in vue2/3

If you want to use 'npm link' project locally, you need to edit "package.module" "package.main" according to vue version.

// vue2
{
  "name": "your-component",
  "module": "./dist/vue2/index.es.js",
  "main": "./dist/vue2/index.umd.js",
  ...
  }
// vue3
{
  "name": "your-component",
  "module": "./dist/vue3/index.es.js",
  "main": "./dist/vue3/index.umd.js",
  ...
  }

Example

Install 'universal-vue-template' which built by this template in vue2 or vue3, it will work correctly.

yarn add universal-vue-template
import Universal from 'universal-vue-template'
import 'universal-vue-template/dist/style.css'

Vue2 example src preview

Vue3 example src preview

universal-vue-component-template's People

Contributors

newbeea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

universal-vue-component-template's Issues

vue2 example counter 不正常

构建之后,使用npm link,example/vue2 的counter组件不正常,vue3是正常的。

看起来是render函数中无法读取到setup函数返回的count属性。通过调试,发现setup在vue2没有执行。这个问题比较奇怪。

打印this,里面没有count属性:
image

如果将组件发布到npm的话是正常的,目测可能是npm link之后某个依赖有问题。

另外vue2也存在2个小问题:

  • Transition 没有被vue-demi导出
    image
  • 本地开发是否可以使用vue2进行预览?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.