# mttk-vue-wrap

> An alternative way of wrapping vue 3 component with pure JS

Latest version **0.3.1** (published 2025-02-07) · 0 weekly downloads

## Install

```sh
npm install mttk-vue-wrap
pnpm add mttk-vue-wrap
yarn add mttk-vue-wrap
bun add mttk-vue-wrap
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2025-02-07 |
| First published | 2023-11-04 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jamie-mttk |

## Links

- npm: https://www.npmjs.com/package/mttk-vue-wrap
- npm.io page: https://npm.io/package/mttk-vue-wrap

## Dependencies (3)

- [vue](https://npm.io/package/vue.md) ^3.5.13
- [@types/vue](https://npm.io/package/@types/vue.md) ^2.0.0
- [@vueuse/core](https://npm.io/package/@vueuse/core.md) ^10.7.2

## Recent versions

- 0.3.1 (latest) — 2025-02-07
- 0.3.0 — 2025-02-06
- 0.2.9 — 2025-01-23
- 0.2.8 — 2024-06-26
- 0.2.7 — 2024-06-20
- 0.2.6 — 2024-05-14
- 0.2.5 — 2024-03-05
- 0.2.4 — 2024-01-02
- 0.2.3 — 2023-12-18
- 0.2.2 — 2023-12-16
- 0.2.1 — 2023-12-08
- 0.2.0 — 2023-11-20
- 0.1.9 — 2023-11-14
- 0.1.8 — 2023-11-14
- 0.1.7 — 2023-11-13
- … 7 more at https://npm.io/package/mttk-vue-wrap/versions

## README

# Mttk Vue Wrap

[中文说明](https://github.com/jamie-mttk/mttk-vue-wrap/blob/master/README_CN.md)

## What is it?

This project implement Vue3 component with pure Javascript instead of Single-File Component(SFC) and could co-work with SFC together.
Generally a vue component includes tempalte/v-model/props/event/slot/method, this project will try to convert them to script with the same functionalities.
So developer could config a component with Javascript rather than to write a full SFC.

This project incldues two projects:

* [Core project](https://github.com/jamie-mttk/mttk-vue-wrap) which implements the full functionalities
* [Demo project](https://github.com/jamie-mttk/mttk-vue-wrap-demo) which is a demo to show how to use vuewrapper

We recommend to preview the project first and then read the [Developer Manual](https://github.com/jamie-mttk/mttk-vue-wrap/blob/master/MANUAL.md)

## Project preview

A live preview of the demo project is available [here](https://mttk.netlify.app/) 


## Demo project Setup

Fork the demo project and then install with the below commands and then enjoy.

```sh
npm install
npm run dev
```

## Quick start

This project render vue compent from a JSON-like object.
Below is sample config to render a element plus input controller.

```sh
export const valueInput = ref("InitValue");

//A simple input configuration
export const configInput ={
    '~component': "ElInput",
    '~modelValue': valueInput,
    placeholder: "Please input value",
    clearable: true}
```

Then use MttkWrapComp to render

```sh
<MttkWrapComp :config="configInput"></MttkWrapComp>
```

## Benifit

SFC includes template/script and style, but these three parts are quite different technologies during coding stage.
The idea of this project is to use pure script(javascript/typescript) to warpping a component. Script is easy to combine/transform/resue so more flexiblity could be gain. For example to add a table component into page, using SFC means to add a el-table and config el-column one by one, the code is long and mixed with template/script; by using this project, a simple pice of JS is enough.

And in the real project we may not care about all the features of the component, so configuration could be simplified and then use a piece of translation code to generate the config of the standard format. Refer to sample table/form/app1 for more detail.

And normally 80% pages are quite similar or they could be summarized into several templates in a real project. So we could define the discrepancy into a config file, and then render the page according to the configuration. Refer to sample app1 for more detail.

And this project is also the fundamental technology of MTTK low code.

## Restriction

Type script is not well supported.
Some Vue 3 features can not not supported,refer to developer manual for more detail.

## License

Mttk Vue Wrap is open source software licensed as MIT.

---
_Source: https://npm.io/package/mttk-vue-wrap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
