commit
4e4e128ffa
12 changed files with 8463 additions and 0 deletions
@ -0,0 +1,2 @@ |
|||
node_modules |
|||
dist |
@ -0,0 +1,13 @@ |
|||
import Vue from "vue"; |
|||
import { VaguerComponents } from "./dist/comp-demo-vue2"; |
|||
|
|||
Vue.use(VaguerComponents); |
|||
|
|||
const app = new Vue({ |
|||
methods: { |
|||
handleClick() { |
|||
alert("222"); |
|||
}, |
|||
}, |
|||
}); |
|||
app.$mount("#app"); |
@ -0,0 +1,14 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|||
<title>Document</title> |
|||
</head> |
|||
<body> |
|||
<div id="app"> |
|||
<vaguer-button @click.native="handleClick">aa</vaguer-button> |
|||
</div> |
|||
<script type="module" src="/dev.ts"></script> |
|||
</body> |
|||
</html> |
@ -0,0 +1,25 @@ |
|||
{ |
|||
"name": "comp-demo-vue2", |
|||
"type": "module", |
|||
"private": true, |
|||
"scripts": { |
|||
"watch": "somebuild build --watch", |
|||
"dev": "somebuild dev", |
|||
"build": "somebuild build" |
|||
}, |
|||
"globals": { |
|||
"vue": "Vue" |
|||
}, |
|||
"dependencies": { |
|||
"vue": "2.6.14", |
|||
"vue-template-compiler": "2.6.14" |
|||
}, |
|||
"devDependencies": { |
|||
"@somebuild/build-component-vue2": "^0.0.3", |
|||
"somebuild": "^0.0.17" |
|||
}, |
|||
"volta": { |
|||
"node": "18.17.1", |
|||
"pnpm": "9.0.6" |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,27 @@ |
|||
import { defineRootConfig } from "somebuild"; |
|||
import fs from "node:fs"; |
|||
|
|||
const loadJSON = (path) => JSON.parse(fs.readFileSync(new URL(path, import.meta.url), "utf8")); |
|||
|
|||
const json = loadJSON("./package.json"); |
|||
|
|||
export default defineRootConfig({ |
|||
mode: "component-vue2", |
|||
"component-vue2": { |
|||
less27: true, |
|||
outDir: "./dist", |
|||
name: json.name, |
|||
dtsEntryRoot: "src", |
|||
entry: "src/index.ts", |
|||
config: { |
|||
vite: { |
|||
resolve: { |
|||
alias: { |
|||
"@": "./src", |
|||
vue: "vue/dist/vue.esm.js", |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
}, |
|||
}); |
@ -0,0 +1,38 @@ |
|||
|
|||
<script> |
|||
export default { |
|||
data(){ |
|||
return { |
|||
a: 123 |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<template> |
|||
<button class="vaguer-button"> |
|||
<slot />-{{ a }} |
|||
</button> |
|||
</template> |
|||
|
|||
<style lang="scss"> |
|||
.vaguer-button { |
|||
color: red; |
|||
// @apply |
|||
// border-none |
|||
// bg-teal-500 |
|||
// text-white |
|||
// font-bold |
|||
// px-4 |
|||
// py-2 |
|||
// rounded |
|||
// cursor-pointer |
|||
|
|||
// transform |
|||
// duration-100 |
|||
// ease-in-out |
|||
|
|||
// hover:(bg-teal-600) |
|||
// active:(scale-90); |
|||
} |
|||
</style> |
@ -0,0 +1,6 @@ |
|||
import VaguerButton from "./VaguerButton.vue" |
|||
|
|||
export { |
|||
VaguerButton |
|||
} |
|||
export default VaguerButton |
@ -0,0 +1,18 @@ |
|||
// const components = import.meta.globEager("./**/*.vue");
|
|||
|
|||
// const exportable: any = {};
|
|||
|
|||
// function getName(key: string) {
|
|||
// return key
|
|||
// .substring(location.pathname.lastIndexOf("/") + 2)
|
|||
// .split(".vue")[0];
|
|||
// }
|
|||
|
|||
// Object.entries(components).forEach(([key, value]) => {
|
|||
// exportable[value.name ? value.name : getName(key)] = value.default;
|
|||
// });
|
|||
|
|||
// export default exportable;
|
|||
import VaguerButton from "./VaguerButton/VaguerButton.vue"; |
|||
|
|||
export { VaguerButton }; |
@ -0,0 +1,17 @@ |
|||
import type { PluginObject } from "vue"; |
|||
|
|||
import * as components from "./components"; |
|||
export default components; |
|||
|
|||
export const VaguerComponents: PluginObject<{}> = { |
|||
install(app) { |
|||
Object.entries(components).forEach(([key, value]: [string, any]) => { |
|||
app.component(key, value); |
|||
}); |
|||
}, |
|||
}; |
|||
console.log(22); |
|||
|
|||
// START_EXPORTS
|
|||
export { default as VaguerButton } from "./components/VaguerButton"; |
|||
// END_EXPORTS
|
@ -0,0 +1,5 @@ |
|||
declare module '*.vue' { |
|||
import { DefineComponent } from 'vue' |
|||
const component: DefineComponent<{}, {}, any> |
|||
export default component |
|||
} |
@ -0,0 +1,13 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"module": "ESNext", |
|||
"moduleResolution": "Bundler", |
|||
"resolveJsonModule": true, |
|||
"esModuleInterop": true, |
|||
"baseUrl": ".", |
|||
"paths": { |
|||
"@/*": ["./src/*"] |
|||
} |
|||
}, |
|||
"exclude": ["node_modules", ".output"] |
|||
} |
Loading…
Reference in new issue