Vue Lim: Make Vue easier to use. (Lim means 'Less is More')
Docs | Playground | React-Lim | 中文
vue-lim is a compilation tool that allows you to get rid of using the Composition API. Here's a simple example
<script setup lim>
let count = 0;
const increase = ()=>{
count ++;
}
</script>
<template>
<button @click="increase">count is {{ count }}</button>
</template>
npm create lim
then choose vue-lim
npm i vue-lim
import { defineConfig } from 'vite'
import lim from 'vue-lim/vite'
import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [lim(), vue()],
// ...
})
import lim from 'vue-lim/rollup'
export default {
plugins: [
lim(),
// Introduce vue related plug-ins by yourself
]
};
import lim from 'vue-lim/esbuild'
import { build } from 'esbuild';
build({
plugins: [
lim(),
// Introduce vue related plug-ins by yourself
],
});
module.exports = {
module: {
rules: [{
test: /(\.vue)$/,
loader: 'vue-lim/webpack',
exclude: /node_modules/
}]
// Introduce vue related loaders by yourself
}
}
When using .lim.vue
as the file suffix, lim compilation will be enabled
When using only .vue
, you need to add lim
attribute on script tag to enable lim compilation
<script setup lim>
// ...
</script>
import { transformVue } from 'vue-lim';
console.log(transformVue(`// some vue code`));
This API can be used in a web environment
<script src='https://cdn.jsdelivr.net/npm/vue-lim'></script>
<script>
console.log(VueLim.transformVue(`// some vue code`));
</script>