mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
feat(vue-components): 添加className配置,page新增css、cssFile、jsFile配置
This commit is contained in:
parent
d1197279fd
commit
9948360435
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"name": "@tmagic/vue-button",
|
"name": "@tmagic/vue-button",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
{
|
||||||
|
name: 'className',
|
||||||
|
type: 'data-source-input',
|
||||||
|
text: 'class',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: '文本',
|
text: '文本',
|
||||||
name: 'text',
|
name: 'text',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.6",
|
"version": "0.0.7",
|
||||||
"name": "@tmagic/vue-container",
|
"name": "@tmagic/vue-container",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
import { getElById } from '@tmagic/core';
|
import { getElById } from '@tmagic/core';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
{
|
||||||
|
name: 'className',
|
||||||
|
type: 'data-source-input',
|
||||||
|
text: 'class',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'layout',
|
name: 'layout',
|
||||||
text: '容器布局',
|
text: '容器布局',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"name": "@tmagic/vue-img",
|
"name": "@tmagic/vue-img",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
{
|
||||||
|
name: 'className',
|
||||||
|
type: 'data-source-input',
|
||||||
|
text: 'class',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: '图片',
|
text: '图片',
|
||||||
name: 'src',
|
name: 'src',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"name": "@tmagic/vue-iterator-container",
|
"name": "@tmagic/vue-iterator-container",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
@ -18,6 +18,11 @@
|
|||||||
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, NODE_CONDS_KEY } from '@tmagic/core';
|
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, NODE_CONDS_KEY } from '@tmagic/core';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
{
|
||||||
|
name: 'className',
|
||||||
|
type: 'data-source-input',
|
||||||
|
text: 'class',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'iteratorData',
|
name: 'iteratorData',
|
||||||
text: '数据源数据',
|
text: '数据源数据',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"name": "@tmagic/vue-page-fragment-container",
|
"name": "@tmagic/vue-page-fragment-container",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
{
|
||||||
|
name: 'className',
|
||||||
|
type: 'data-source-input',
|
||||||
|
text: 'class',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'pageFragmentId',
|
name: 'pageFragmentId',
|
||||||
text: '页面片ID',
|
text: '页面片ID',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.4",
|
"version": "0.0.6",
|
||||||
"name": "@tmagic/vue-page",
|
"name": "@tmagic/vue-page",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
@ -28,7 +28,6 @@ export default [
|
|||||||
{
|
{
|
||||||
text: '页面标题',
|
text: '页面标题',
|
||||||
name: 'title',
|
name: 'title',
|
||||||
type: 'data-source-input',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'layout',
|
name: 'layout',
|
||||||
@ -51,4 +50,33 @@ export default [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'jsFiles',
|
||||||
|
text: 'js',
|
||||||
|
type: 'table',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
name: 'url',
|
||||||
|
label: '链接',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'cssFiles',
|
||||||
|
text: 'css',
|
||||||
|
type: 'table',
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
name: 'url',
|
||||||
|
label: '链接',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'css',
|
||||||
|
name: 'css',
|
||||||
|
type: 'code',
|
||||||
|
language: 'css',
|
||||||
|
height: '500px',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
@ -5,9 +5,31 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, type PropType } from 'vue-demi';
|
import { defineComponent, type PropType } from 'vue-demi';
|
||||||
|
|
||||||
import type { MPage } from '@tmagic/core';
|
import { asyncLoadCss, asyncLoadJs, type MPage } from '@tmagic/core';
|
||||||
import { useApp, useComponent } from '@tmagic/vue-runtime-help';
|
import { useApp, useComponent } from '@tmagic/vue-runtime-help';
|
||||||
|
|
||||||
|
const createCss = (config: MPage) => {
|
||||||
|
if (config.cssFile) {
|
||||||
|
asyncLoadCss(config.cssFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(config.cssFiles)) {
|
||||||
|
config.cssFiles.map((file) => asyncLoadCss(file.url));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.css) {
|
||||||
|
const style = window.document.createElement('style');
|
||||||
|
style.innerHTML = config.css;
|
||||||
|
window.document.head.appendChild(style);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const createJs = (config: MPage) => {
|
||||||
|
if (Array.isArray(config.jsFiles)) {
|
||||||
|
config.jsFiles.map((file) => asyncLoadJs(file.url));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
config: {
|
config: {
|
||||||
@ -30,6 +52,11 @@ export default defineComponent({
|
|||||||
methods: { refresh },
|
methods: { refresh },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (app?.jsEngine === 'browser') {
|
||||||
|
createCss(props.config);
|
||||||
|
createJs(props.config);
|
||||||
|
}
|
||||||
|
|
||||||
const containerComponent = useComponent({ componentType: 'container', app });
|
const containerComponent = useComponent({ componentType: 'container', app });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"name": "@tmagic/vue-qrcode",
|
"name": "@tmagic/vue-qrcode",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
{
|
||||||
|
name: 'className',
|
||||||
|
type: 'data-source-input',
|
||||||
|
text: 'class',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
text: '链接',
|
text: '链接',
|
||||||
name: 'url',
|
name: 'url',
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"name": "@tmagic/vue-text",
|
"name": "@tmagic/vue-text",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
|
{
|
||||||
|
name: 'className',
|
||||||
|
type: 'data-source-input',
|
||||||
|
text: 'class',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'text',
|
name: 'text',
|
||||||
text: '文本',
|
text: '文本',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user