= [
8 | {
9 | path: "/",
10 | name: "Home",
11 | component: Home,
12 | }
13 | ];
14 |
15 | const router = new VueRouter({
16 | mode: "history",
17 | base: process.env.BASE_URL,
18 | routes,
19 | });
20 |
21 | export default router;
22 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
31 |
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | <%= htmlWebpackPlugin.options.title %>
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: {
4 | node: true,
5 | },
6 | extends: [
7 | "plugin:vue/essential",
8 | "eslint:recommended",
9 | "@vue/typescript/recommended",
10 | "@vue/prettier",
11 | "@vue/prettier/@typescript-eslint",
12 | ],
13 | parserOptions: {
14 | ecmaVersion: 2020,
15 | },
16 | rules: {
17 | "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
18 | "no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
19 | "@typescript-eslint/no-empty-function": "off"
20 | },
21 | overrides: [
22 | {
23 | files: [
24 | "**/__tests__/*.{j,t}s?(x)",
25 | "**/tests/unit/**/*.spec.{j,t}s?(x)",
26 | ],
27 | env: {
28 | jest: true,
29 | },
30 | },
31 | ],
32 | };
33 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | // eslint-disable-next-line @typescript-eslint/no-var-requires
2 | const path = require('path')
3 |
4 | function resolve (dir) {
5 | return path.join(__dirname, dir)
6 | }
7 |
8 | module.exports = {
9 | chainWebpack: config => {
10 | console.log("chainWebpack");
11 |
12 | const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
13 | types.forEach(type => addStyleResource(config.module.rule('scss').oneOf(type)))
14 |
15 | config.resolve.alias
16 | .set('TEFACT_EDITOR', resolve('./node_modules/@tefact/editor/src'))
17 | },
18 | }
19 |
20 | function addStyleResource (rule) {
21 | rule.use('style-resource')
22 | .loader('style-resources-loader')
23 | .options({
24 | patterns: [
25 | path.resolve(__dirname, './src/assets/style/variable.scss'),
26 | ],
27 | })
28 | }
--------------------------------------------------------------------------------
/src/assets/style/variable.scss:
--------------------------------------------------------------------------------
1 |
2 | // main
3 | $mainColor: #3181DE;
4 | $secondColor: #a1bede;
5 | $thirdColor: #38b0e4;
6 | $dangerColor: #f56c6c;
7 |
8 | $borderColor: #e2e8f0;
9 | $borderSecondColor: #E2E2EA;
10 |
11 | $textMainColor: #919bae;
12 |
13 | $editor-menu-color: #2c3d59;
14 | $editor-text-color: #000000cc;
15 | $editor-main-color: #00b4ff;
16 | $editor-border-active-color: #00b4ff;
17 | $editor-border-focus-color: #ff0000;
18 |
19 | $editor-text-active-color: $editor-main-color;
20 | $editor-node-border-color: $editor-border-active-color;
21 |
22 |
23 | $bg-02: #f3f6fb;
24 |
25 | $gray-01: #f1f2f5;
26 | $gray-02: #f4f7fd;
27 | $gray-03: #F5F7FA;
28 | $gray-05: #c0c4cc;
29 |
30 | $mainColor: #3181DE;
31 | $borderColor: #e2e8f0;
32 | $defaultTextColor: #92929D;
33 | $mainTextColor: #414141;
34 | $defaultHover: #ebf3ff;
35 | $hoverBackground: #eaf2fc;
36 |
37 | $editorBackground: #f0f2f5;
38 |
39 | :export{
40 | mainColor : $mainColor
41 | }
42 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "module": "esnext",
5 | "strict": true,
6 | "jsx": "preserve",
7 | "importHelpers": true,
8 | "moduleResolution": "node",
9 | "skipLibCheck": true,
10 | "esModuleInterop": true,
11 | "allowSyntheticDefaultImports": true,
12 | "experimentalDecorators": true,
13 | "noImplicitAny": false,
14 | "sourceMap": true,
15 | "resolveJsonModule": true,
16 | "baseUrl": ".",
17 | "types": [
18 | "webpack-env",
19 | "jest"
20 | ],
21 | "paths": {
22 | "@/*": [
23 | "src/*"
24 | ]
25 | },
26 | "lib": [
27 | "esnext",
28 | "dom",
29 | "dom.iterable",
30 | "scripthost"
31 | ]
32 | },
33 | "include": [
34 | "src/**/*.ts",
35 | "src/**/*.tsx",
36 | "src/**/*.vue",
37 | "tests/**/*.ts",
38 | "tests/**/*.tsx"
39 | ],
40 | "exclude": [
41 | "node_modules"
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |

3 |
4 |
11 |
12 |
13 |
14 |
15 |
16 | [](https://github.com/Tefact/tefact-saas)
17 | [](https://github.com/tefact/tefact-saas/actions)
18 | [](https://github.com/Tefact/tefact-saas/releases)
19 | [](https://github.com/Tefact/tefact-saas/pulls)
20 | [](https://lgtm.com/projects/g/Tefact/tefact-saas/alerts/)
21 |
22 |
23 |
24 | [Tefact 低代码编辑器](https://github.com/staringos/tefact) 使用案例.
25 |
26 |
27 |
28 | ## 安装依赖
29 | ```
30 | npm install
31 | ```
32 |
33 | ### 开发模式启动
34 |
35 | ```
36 | npm run serve
37 | ```
38 |
39 | ### 生产模式打包
40 | ```
41 | npm run build
42 | ```
43 |
44 | ### Lints and fixes files
45 | ```
46 | npm run lint
47 | ```
48 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tefact-emample",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "serve": "vue-cli-service serve",
7 | "build": "vue-cli-service build",
8 | "test:unit": "vue-cli-service test:unit",
9 | "lint": "vue-cli-service lint"
10 | },
11 | "dependencies": {
12 | "@tefact/editor": "0.0.2-alpha.9",
13 | "core-js": "^3.6.5",
14 | "element-ui": "^2.15.2",
15 | "vue": "^2.6.11",
16 | "vue-router": "^3.2.0",
17 | "vuex": "^3.4.0"
18 | },
19 | "devDependencies": {
20 | "@types/jest": "^24.0.19",
21 | "@typescript-eslint/eslint-plugin": "^4.18.0",
22 | "@typescript-eslint/parser": "^4.18.0",
23 | "@vue/cli-plugin-babel": "~4.5.0",
24 | "@vue/cli-plugin-eslint": "~4.5.0",
25 | "@vue/cli-plugin-router": "~4.5.0",
26 | "@vue/cli-plugin-typescript": "~4.5.0",
27 | "@vue/cli-plugin-unit-jest": "~4.5.0",
28 | "@vue/cli-plugin-vuex": "~4.5.0",
29 | "@vue/cli-service": "~4.5.0",
30 | "@vue/eslint-config-prettier": "^6.0.0",
31 | "@vue/eslint-config-typescript": "^7.0.0",
32 | "@vue/test-utils": "^1.0.3",
33 | "eslint": "^6.7.2",
34 | "eslint-plugin-prettier": "^3.3.1",
35 | "eslint-plugin-vue": "^6.2.2",
36 | "lint-staged": "^9.5.0",
37 | "prettier": "^2.2.1",
38 | "sass": "^1.26.5",
39 | "sass-loader": "^8.0.2",
40 | "style-resources-loader": "^1.4.1",
41 | "typescript": "~4.1.5",
42 | "vue-template-compiler": "^2.6.11"
43 | },
44 | "gitHooks": {
45 | "pre-commit": "lint-staged"
46 | },
47 | "lint-staged": {
48 | "*.{js,jsx,vue,ts,tsx}": [
49 | "vue-cli-service lint",
50 | "git add"
51 | ]
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/components/EditorPage.vue:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
66 |
67 |
68 |
84 |
--------------------------------------------------------------------------------