1
0
mirror of https://github.com/sahadev/vue-component-creater-ui.git synced 2025-06-07 21:54:05 +08:00

基本逻辑可实现

This commit is contained in:
Shangbin 2021-04-11 22:33:19 +08:00
parent e5a2ed4484
commit d51f6b0a27
15 changed files with 1354 additions and 1212 deletions

1
.env.dev Normal file
View File

@ -0,0 +1 @@
PUBLIC_PATH=/dist/

1
.env.production Normal file
View File

@ -0,0 +1 @@
PUBLIC_PATH=/dist/

1
demo/build.js Normal file

File diff suppressed because one or more lines are too long

28
demo/index.html Normal file
View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Vue App</title>
<link href="/build.js" rel="preload" as="script">
<link rel="icon" type="image/png" sizes="32x32" href="/img/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/img/icons/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="theme-color" content="#4DBA87">
<meta name="apple-mobile-web-app-capable" content="no">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-mobile-web-app-title" content="vue-component-creater-ui">
<link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-152x152.png">
<link rel="mask-icon" href="/img/icons/safari-pinned-tab.svg" color="#4DBA87">
<meta name="msapplication-TileImage" content="/img/icons/msapplication-icon-144x144.png">
<meta name="msapplication-TileColor" content="#000000">
</head>
<body>
<div id="app"></div>
<script src="/build.js"></script>
</body>
</html>

1
demo/manifest.json Normal file
View File

@ -0,0 +1 @@
{"name":"vue-component-creater-ui","short_name":"vue-component-creater-ui","theme_color":"#4DBA87","icons":[{"src":"./img/icons/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"./img/icons/android-chrome-512x512.png","sizes":"512x512","type":"image/png"},{"src":"./img/icons/android-chrome-maskable-192x192.png","sizes":"192x192","type":"image/png","purpose":"maskable"},{"src":"./img/icons/android-chrome-maskable-512x512.png","sizes":"512x512","type":"image/png","purpose":"maskable"}],"start_url":".","display":"standalone","background_color":"#000000"}

View File

@ -0,0 +1,14 @@
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "88870b35b53b9734399c",
"url": "/build.js"
},
{
"revision": "52e7d3ac8275b87a8a9afaef009db523",
"url": "/index.html"
},
{
"revision": "6e533af5a378b6f5f8882e5663f51b8e",
"url": "/manifest.json"
}
]);

34
demo/service-worker.js Normal file
View File

@ -0,0 +1,34 @@
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.9312fbe25eca40ea4453aa0e3600bbad.js"
);
workbox.core.setCacheNameDetails({prefix: "vue-component-creater-ui"});
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

10
index.js Normal file
View File

@ -0,0 +1,10 @@
import Main from "./src/components-v2/Main";
// 这一步判断window.Vue是否存在因为直接引用vue.min.js 它会把Vue绑到Window上我们直接引用打包好的js才能正常跑起来。
if (typeof window !== "undefined" && window.Vue) {
window.Vue.component(Main.name, Main);
}
//这样就可以使用Vue.use进行全局安装了。
Main.install = function(Vue) {
Vue.component(Main.name, Main);
};
export default Main;

View File

@ -4,7 +4,7 @@ import "element-ui/lib/theme-chalk/index.css";
import AntdUI from "ant-design-vue";
import "ant-design-vue/dist/antd.css";
import Main from "./components-v2/Main.vue";
import Main from "./dist/vue-component-creater-ui.common.js";
Vue.use(ElementUI);
Vue.use(AntdUI);
@ -13,3 +13,4 @@ new Vue({
el: "#app",
render: (h) => h(Main),
});

2359
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,10 +2,10 @@
"name": "vue-component-creater-ui",
"version": "0.1.0",
"private": true,
"main":"./src/main.js",
"main": "./src/main.js",
"scripts": {
"serve": "vue-cli-service serve --open --port 8008",
"build": "vue-cli-service build --target wc --name vcc-ui ./Main.vue --inline-vue",
"build": "vue-cli-service build --target lib ./index.js",
"compileAndbuild:dev": "npm run compileComponent && vue-cli-service build",
"lint": "vue-cli-service lint",
"build:prod": "vue-cli-service build --mode production",

View File

@ -57,6 +57,10 @@ import ToolsBar from "./ToolsBar";
import { initContainerForLine } from "@/utils/lineHelper";
const keymaster = require('keymaster');
import AttributeInput from "../components/AttributeInput";
import CodeStructure from "../components/CodeStructure";
import Code from "../components/Code";
import styleData from "../map/style.index.js";
import methodData from "../map/method.index.js";
import dataData from "../map/data.index.js";
@ -73,9 +77,9 @@ export default {
components: {
RawComponents,
ToolsBar,
AttributeInput: resolve => { require(["../components/AttributeInput"], resolve) },
CodeStructure: resolve => { require(["../components/CodeStructure"], resolve) },
"lc-code": resolve => { require(["../components/Code"], resolve) },
AttributeInput,
CodeStructure,
"lc-code": Code,
},
data() {
return {

61
src/components/Main.vue Normal file
View File

@ -0,0 +1,61 @@
<template>
<div id="app" class="con">
<h1>{{ msg }}</h1>
<h2>Essential Links</h2>
<h1 class="n">曙光</h1>
<el-button>Button</el-button>
</div>
</template>
<script>
export default {
name: 'app',
data() {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script>
<style lang="scss" scoped>
.con {
font-size: 10px;
.n {
font-weight: 600;
color: red;
}
}
</style>
<style >
#app {
font-family: "Avenir", Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
h1,
h2 {
font-weight: normal;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@ -59,6 +59,8 @@
// import vant from "../rawComponents/vant";
// import iview from "../rawComponents/iview";
// import quasar from "../rawComponents/quasar";
import raw from "../rawComponents/raw";
import ele from "../rawComponents/element";
export default {
data() {
@ -202,11 +204,11 @@ export default {
},
components: {
raw: () => import("../rawComponents/raw"),
raw,
// vant,
// iview,
// quasar,
ele: () => import("../rawComponents/element"),
ele,
},
};

View File

@ -1,6 +1,21 @@
const path = require("path");
module.exports = {
css: { extract: false },
configureWebpack:
process.env.NODE_ENV === "production"
? {
entry: "./index.js",
output: {
filename: "build.js",
library: "vccui",
libraryTarget: "umd",
umdNamedDefine: true,
},
}
: {
entry: "./main.js"
},
lintOnSave: true,
@ -17,7 +32,7 @@ module.exports = {
};
});
config.resolve.alias.set("vue$", "vue/dist/vue.esm.js")
config.resolve.alias.set("vue$", "vue/dist/vue.esm.js");
},
publicPath: process.env.PUBLIC_PATH,
@ -25,12 +40,10 @@ module.exports = {
pluginOptions: {
quasar: {
importStrategy: 'kebab',
rtlSupport: false
}
importStrategy: "kebab",
rtlSupport: false,
},
},
transpileDependencies: [
'quasar'
],
transpileDependencies: ["quasar"],
};