+
+
+
+ {{ data.label }}
+
+
+ {{ data.label }}
+
+
+
+
+
diff --git a/packages/vue-generator/test/testcases/sfc/case06/page.schema.json b/packages/vue-generator/test/testcases/sfc/case06/page.schema.json
new file mode 100644
index 000000000..7b5ec4ff0
--- /dev/null
+++ b/packages/vue-generator/test/testcases/sfc/case06/page.schema.json
@@ -0,0 +1,143 @@
+{
+ "state": {},
+ "methods": {},
+ "componentName": "Page",
+ "fileName": "createVm",
+ "css": "",
+ "props": {},
+ "lifeCycles": {},
+ "children": [
+ {
+ "componentName": "TinyTree",
+ "props": {
+ "data": [
+ {
+ "label": "一级 1",
+ "children": [
+ {
+ "label": "二级 1-1",
+ "children": [
+ {
+ "label": "三级 1-1-1"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "label": "一级 2",
+ "children": [
+ {
+ "label": "二级 2-1",
+ "children": [
+ {
+ "label": "三级 2-1-1"
+ }
+ ]
+ },
+ {
+ "label": "二级 2-2",
+ "children": [
+ {
+ "label": "三级 2-2-1"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "id": "33f52342",
+ "children": [
+ {
+ "componentName": "Template",
+ "props": {
+ "slot": {
+ "name": "default",
+ "params": ["data"]
+ }
+ },
+ "children": [
+ {
+ "componentName": "Text",
+ "props": {
+ "text": {
+ "type": "JSExpression",
+ "value": "data.label"
+ }
+ },
+ "id": "c225d165"
+ }
+ ],
+ "id": "415d5f65"
+ }
+ ]
+ },
+ {
+ "componentName": "TinyTree",
+ "props": {
+ "data": [
+ {
+ "label": "一级 1",
+ "children": [
+ {
+ "label": "二级 1-1",
+ "children": [
+ {
+ "label": "三级 1-1-1"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "label": "一级 2",
+ "children": [
+ {
+ "label": "二级 2-1",
+ "children": [
+ {
+ "label": "三级 2-1-1"
+ }
+ ]
+ },
+ {
+ "label": "二级 2-2",
+ "children": [
+ {
+ "label": "三级 2-2-1"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ },
+ "id": "33f52342",
+ "children": [
+ {
+ "componentName": "Template",
+ "props": {
+ "slot": {
+ "name": "default",
+ "params": "data"
+ }
+ },
+ "children": [
+ {
+ "componentName": "Text",
+ "props": {
+ "text": {
+ "type": "JSExpression",
+ "value": "data.label"
+ }
+ },
+ "id": "c225d165"
+ }
+ ],
+ "id": "415d5f65"
+ }
+ ]
+ }
+ ]
+}
diff --git a/packages/vue-generator/vite.config.mjs b/packages/vue-generator/vite.config.mjs
index 60005cb53..3c1256679 100644
--- a/packages/vue-generator/vite.config.mjs
+++ b/packages/vue-generator/vite.config.mjs
@@ -17,7 +17,7 @@ import { viteStaticCopy } from 'vite-plugin-static-copy'
// https://vitejs.dev/config/
export default defineConfig({
test: {
- exclude: ['**/result/**'],
+ exclude: ['**/result/**', 'node_modules'],
watchExclude: ['**/result/**']
},
resolve: {
diff --git a/scripts/buildMaterials.mjs b/scripts/buildMaterials.mjs
index 01e768b19..100636460 100644
--- a/scripts/buildMaterials.mjs
+++ b/scripts/buildMaterials.mjs
@@ -12,7 +12,10 @@ const materialsDir = 'materials'
const bundlePath = path.join(process.cwd(), '/packages/design-core/public/mock/bundle.json')
// mockServer应用数据
const appInfoPath = path.join(process.cwd(), '/mockServer/src/services/appinfo.json')
+const appSchemaPath = path.join(process.cwd(), 'mockServer/src/mock/get/app-center/v1/apps/schema/918.json')
+
const appInfo = fsExtra.readJSONSync(appInfoPath)
+const appSchema = fsExtra.readJSONSync(appSchemaPath)
const connection = new MysqlConnection()
@@ -22,6 +25,7 @@ const connection = new MysqlConnection()
const write = (bundle) => {
fsExtra.outputJSONSync(bundlePath, bundle, { spaces: 2 })
fsExtra.outputJSONSync(appInfoPath, appInfo, { spaces: 2 })
+ fsExtra.outputJSONSync(appSchemaPath, appSchema, { spaces: 2 })
}
/**
@@ -95,6 +99,7 @@ const generateComponents = () => {
}
const { components = [], snippets = [], blocks = [] } = bundle.data.materials
const componentsMap = []
+ const packagesMap = []
const appInfoBlocksLabels = appInfo.blockHistories.map((item) => item.label)
files.forEach((file) => {
@@ -151,8 +156,26 @@ const generateComponents = () => {
appInfo.materialHistory.components = componentsMap
- write(bundle)
+ const { package: packageName = '', version = '', exportName = '' } = npm || {}
+
+ const mapItem = {
+ componentName: component,
+ package: packageName,
+ version,
+ exportName
+ }
+
+ if (typeof npm.destructuring === 'boolean') {
+ mapItem.destructuring = npm.destructuring
+ }
+
+ if (npm.package) {
+ packagesMap.push(mapItem)
+ }
})
+
+ appSchema.data.componentsMap = packagesMap
+ write(bundle)
})
logger.success('物料资产包构建成功')