国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

web架構(gòu)師編輯器內(nèi)容-完成屬性設(shè)置的優(yōu)化

這篇具有很好參考價(jià)值的文章主要介紹了web架構(gòu)師編輯器內(nèi)容-完成屬性設(shè)置的優(yōu)化。希望對大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

對于業(yè)務(wù)組件來說,其屬性是有很多的,如果把所有屬性都平鋪在頁面上,就會非常長,而且想要更改其中的某些屬性,可能需要向下滾動(dòng)很久才能找到,對于UI的交互不是很友好,需要對屬性的不同特性進(jìn)行分組。
改造前:
web架構(gòu)師編輯器內(nèi)容-完成屬性設(shè)置的優(yōu)化,慕課網(wǎng)-Web前端架構(gòu)師,前端,編輯器,microsoft
改造后:
web架構(gòu)師編輯器內(nèi)容-完成屬性設(shè)置的優(yōu)化,慕課網(wǎng)-Web前端架構(gòu)師,前端,編輯器,microsoft
先來看一下通用屬性:

// defaultProps.ts
export interface CommonComponentProps {
  // actions
  actionType: string;
  url: string;
  // size
  height: string;
  width: string;
  paddingLeft: string;
  paddingRight: string;
  paddingTop: string;
  paddingBottom: string;
  // border type
  borderStyle: string;
  borderColor: string;
  borderWidth: string;
  borderRadius: string;
  // shadow and opacity
  boxShadow: string;
  opacity: string;
  // position and x,y
  position: string;
  left: string;
  top: string;
  right: string;
}

CommonComponentProps一開始就是按照不同的屬性進(jìn)行分類的,所以比較符合我們的一個(gè)需求。
首先,組件總屬性分兩大類:業(yè)務(wù)組件(獨(dú)特屬性),通用屬性(CommonComponentProps)

// 文本組件
export interface TextComponentProps extends CommonComponentProps {
  text: string;
  fontSize: string;
  fontFamily: string;
  fontWeight: string;
  fontStyle: string;
  textDecoration: string;
  lineHeight: string;
  textAlign: string;
  color: string;
  backgroundColor: string;
}
// 圖片組件
export interface ImageComponentProps extends CommonComponentProps {
  src: string;
}

將組件通用屬性分類分多個(gè)小類: size,border type,shadow…
然后創(chuàng)建一個(gè)新的組件 EditGroup,
<EditGroups :props="currentElement.props">
在EditGroup 中的目的就是 props 轉(zhuǎn)換成數(shù)組的多項(xiàng),每個(gè)數(shù)組對應(yīng)一個(gè)選項(xiàng)卡:

[
  {
  	text: '基礎(chǔ)屬性',
  	// specialProps = Object.keys(props.props) - allNormalProps
    items: specialProps,
  },
  {
 	text: '尺寸',
    items: [...]
  }
]

通用屬性這里是定死的,我們手動(dòng)添加這樣的關(guān)系即可。

[
  {
    text: '尺寸',
    items: ['height', 'width', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom']
  },
  ...
]

數(shù)據(jù)的前期準(zhǔn)備:
這里的屬性需要使用默認(rèn)屬性完成一個(gè)混入,也就是將屬性添加完整:

// 完成數(shù)據(jù)的一個(gè)混入
// defaultProps.ts
const imageDefaultProps: ImageComponentProps = {
  src: 'test.url',
  ...commonDefaultProps
}
const textDefautlProps: TextComponentProps = {
  // basic props - font styles
  text: "正文內(nèi)容",
  fontSize: "14px",
  fontFamily: "",
  fontWeight: "normal",
  fontStyle: "normal",
  textDecoration: "none",
  lineHeight: "1",
  textAlign: "left",
  color: "#000000",
  backgroundColor: "",
  ...commonDefaultProps,
}
// store.ts
export const testComponents: ComponentData[] = [
{ id: uuidv4(), name: 'l-text', layerName:'圖層3', props: { ...textDefaultProps, text: 'hello3', fontSize: '15px', actionType: 'url', url: 'https://www.baidu.com', 'lineHeight': '3', textAlign: 'left', fontFamily: '' }},
{ id: uuidv4(), name: 'l-image', layerName:'圖層4', props: { ...imageDefaultProps, src: 'http://vue-maker.oss-cn-hangzhou.aliyuncs.com/vue-marker/5f3e3a17c305b1070f455202.jpg', width: '100px' }},
]

propsMap 對應(yīng)關(guān)系的繼續(xù)添加,這里也要將對應(yīng)關(guān)系添加完整。
業(yè)務(wù)組件 - 獨(dú)特屬性 需要經(jīng)過計(jì)算
其實(shí)就是所有屬性的數(shù)組(全集) 通用屬性的數(shù)組(子集)求差集 的得出的結(jié)果:
specialProps = Object.keys(props.props) - allNormalProps
然后將 specialProps 得出的內(nèi)容,添加到數(shù)組的第一項(xiàng)去
最終循環(huán)數(shù)組得出對應(yīng)的界面
代碼實(shí)現(xiàn):文章來源地址http://www.zghlxwxcb.cn/news/detail-814922.html

  1. 將屬性數(shù)據(jù)混入補(bǔ)充完整
export const testComponents: ComponentData[] = [
  { id: uuidv4(), name: 'l-text', layerName:'圖層1', props: { ...textDefaultProps, text: 'hello', fontSize: '20px', color: '#000000', 'lineHeight': '1', textAlign: 'left', fontFamily: '' }},
  { id: uuidv4(), name: 'l-text', layerName:'圖層2', props: { ...textDefaultProps, text: 'hello2', fontSize: '10px', fontWeight: 'bold', 'lineHeight': '2', textAlign: 'left', fontFamily: '' }},
  { id: uuidv4(), name: 'l-text', layerName:'圖層3', props: { ...textDefaultProps, text: 'hello3', fontSize: '15px', actionType: 'url', url: 'https://www.baidu.com', 'lineHeight': '3', textAlign: 'left', fontFamily: '' }},
  { id: uuidv4(), name: 'l-image', layerName:'圖層4', props: { ...imageDefaultProps, src: 'http://vue-maker.oss-cn-hangzhou.aliyuncs.com/vue-marker/5f3e3a17c305b1070f455202.jpg', width: '100px' }},
]
  1. EditGroup.vue

<template>
  <div class="edit-groups">
    <div v-for="item in newGroups" :key="item.text">
      <h1>{{item.text}}</h1>
      <pre>{{item.items}}</pre>
    </div>
  </div>
</template>

<script lang="ts">
import { AllComponentProps } from 'lego-bricks-sea';
import { difference } from 'lodash'
import { defineComponent, PropType, computed } from 'vue';
export interface GroupProps {
  text: string;
  items: string[];
}
const defaultEditGroups: GroupProps[] = [
  {
    text: '尺寸',
    items: [
      'height',
      'width',
      'paddingLeft',
      'paddingRight',
      'paddingTop',
      'paddingBottom',
    ],
  },
  {
    text: '邊框',
    items: ['borderStyle', 'borderColor', 'borderWidth', 'borderRadius'],
  },
  {
    text: '陰影與透明度',
    items: ['opacity', 'boxShadow'],
  },
  {
    text: '位置',
    items: ['left', 'top'],
  },
  {
    text: '事件功能',
    items: ['actionType', 'url'],
  },
];
export default defineComponent({
  props: {
    props: {
      type: Object as PropType<AllComponentProps>,
      required: true,
    },
    groups: {
      type: Array as PropType<GroupProps[]>,
      default: defaultEditGroups,
    },
  },
  setup(props) {
    const newGroups = computed(() => {
      const allNormalProps = props.groups.reduce((prev, current) => {
        return [...prev, ...current.items]
      }, [] as string[])
      const specialProps = difference(Object.keys(props.props), allNormalProps)
      return [
        {
          text: '基本屬性',
          items: specialProps
        },
        ...props.groups
      ]
    })
    return {
      newGroups
    }
  },
});
</script>

<style></style>

到了這里,關(guān)于web架構(gòu)師編輯器內(nèi)容-完成屬性設(shè)置的優(yōu)化的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • React 框架下自己寫一個(gè)braft編輯器,然后將編輯器內(nèi)容展示在網(wǎng)頁端

    React 框架下自己寫一個(gè)braft編輯器,然后將編輯器內(nèi)容展示在網(wǎng)頁端

    1.首先自己寫一個(gè)編輯器 輸入文字; 支持選擇表情; 可添加小程序鏈接;可添加網(wǎng)頁鏈接;并且可以編輯刪除;效果如下 2.輸入完畢后,點(diǎn)擊文本輸入框保存,將便攜式內(nèi)容回顯, 渲染時(shí),因?yàn)槭莌tml格式,所以采用dangerouslySetInnerHTML屬性來渲染 添加樣式,渲染后里面的鏈接

    2024年02月16日
    瀏覽(32)
  • AJAX + PHP 編輯器內(nèi)容自動(dòng)備份草稿保存到本地 (適用ueditor百度編輯器或其它) 內(nèi)容變化后自動(dòng)觸發(fā)備份txt文件

    AJAX + PHP 編輯器內(nèi)容自動(dòng)備份草稿保存到本地 (適用ueditor百度編輯器或其它) 內(nèi)容變化后自動(dòng)觸發(fā)備份txt文件

    百度自帶的自動(dòng)備份功能enableAutoSave存在問題, 比如第一個(gè)文章他自動(dòng)備份了.等發(fā)表第二個(gè)文章時(shí),結(jié)果把第一個(gè)文章的內(nèi)容自動(dòng)填充進(jìn)去了.關(guān)鍵你還不知情!出現(xiàn)過多次這種情況了. 一, 百度原版的 ,具體使用方法,看這里個(gè)文章 Ueditor百度編輯器內(nèi)容自動(dòng)保存到本地防數(shù)據(jù)丟失

    2024年02月10日
    瀏覽(22)
  • 【HTML】標(biāo)簽讀取富文本編輯器的內(nèi)容

    【HTML】標(biāo)簽讀取富文本編輯器的內(nèi)容

    1.正確讀取富文本內(nèi)容示例: 代碼: ?顯示結(jié)果: ?在這個(gè)例子中, {$row.content} ?是直接輸出從數(shù)據(jù)庫中獲取的富文本內(nèi)容,包括可能存在的HTML標(biāo)簽和屬性,這樣可以確保富文本能夠按照預(yù)期樣式呈現(xiàn)。 2. 錯(cuò)誤讀取富文本內(nèi)容示例及其原因分析: ?代碼: ?顯示結(jié)果: 分析

    2024年02月02日
    瀏覽(37)
  • Unity 編輯器-創(chuàng)建模板腳本,并自動(dòng)綁定屬性,添加點(diǎn)擊事件

    Unity 編輯器-創(chuàng)建模板腳本,并自動(dòng)綁定屬性,添加點(diǎn)擊事件

    當(dāng)使用框架開發(fā)時(shí),Prefab掛載的很多腳本都有固定的格式。從Unity的基礎(chǔ)模板創(chuàng)建cs文件,再修改到應(yīng)有的模板,會浪費(fèi)一些時(shí)間。尤其是有大量的不同界面時(shí),每個(gè)都改一遍,浪費(fèi)時(shí)間不說,還有可能遺漏或錯(cuò)改。寫個(gè)腳本創(chuàng)建指定的模板代替C#基礎(chǔ)模板。 注:當(dāng)前腳本使用

    2024年02月13日
    瀏覽(86)
  • 工業(yè)組態(tài) 物聯(lián)網(wǎng)組態(tài) 組態(tài)編輯器 web組態(tài) 組態(tài)插件 編輯器

    工業(yè)組態(tài) 物聯(lián)網(wǎng)組態(tài) 組態(tài)編輯器 web組態(tài) 組態(tài)插件 編輯器

    ?體驗(yàn)地址:by組態(tài)[web組態(tài)插件] BY組態(tài)是一款非常優(yōu)秀的純前端的【web組態(tài)插件工具】,可無縫嵌入到vue項(xiàng)目,react項(xiàng)目等,由于是原生js開發(fā),對于前端的集成沒有框架的限制。同時(shí)由于BY組態(tài)只是一個(gè)插件,不能獨(dú)立運(yùn)行,必須嵌入到你方軟件平臺才能使用,所以你方軟件

    2024年04月15日
    瀏覽(67)
  • 利用三維內(nèi)容編輯器制作VR交互課件,簡單好用易上手

    利用三維內(nèi)容編輯器制作VR交互課件,簡單好用易上手

    隨著虛擬現(xiàn)實(shí)技術(shù)的不斷發(fā)展,越來越多的教育機(jī)構(gòu)開始嘗試將其應(yīng)用于教育教學(xué)中。然而,要實(shí)現(xiàn)這一目標(biāo)并不容易,需要專業(yè)的技術(shù)支持和開發(fā)團(tuán)隊(duì)。 為了解決這一問題, 廣州華銳互動(dòng) 研發(fā)了 三維內(nèi)容編輯器 ,它是一種基于虛擬現(xiàn)實(shí)技術(shù)的教育內(nèi)容編輯器,可以幫助

    2024年02月12日
    瀏覽(24)
  • Unity快手上手【熟悉unity編輯器,C#腳本控制組件一些屬性之類的】

    首先了解unity相關(guān)概述,快速認(rèn)識unity編輯器,然后抓住重點(diǎn)的學(xué):游戲?qū)ο蟆⒔M件|C#腳本、預(yù)制體、UI ? 學(xué)習(xí)過程你會發(fā)現(xiàn),其實(shí)Unity中主要是用c#進(jìn)行開發(fā)。 因?yàn)樵谶@個(gè)過程中,無非就是,對游戲?qū)ο笸ㄟ^掛載的C#腳本,修改一下組件的一些屬性,控制一下激活之類的操作

    2023年04月13日
    瀏覽(35)
  • idea設(shè)置編輯器背景顏色

    idea設(shè)置編輯器背景顏色

    在File-Settings-Editor-Color Scheme-General 豆沙綠:R:199, G: 237, B:204 給所有新打開項(xiàng)目配置maven默認(rèn)配置目錄和本地倉庫目錄 給所有新打開項(xiàng)目配置jdk等配置 :encoding :serialVersionUID

    2024年01月19日
    瀏覽(20)
  • ruby - ckeditor 設(shè)置編輯器高度

    參考:Blogs %= f.cktext_area :zh_content, ckeditor: { height: 1000} %

    2024年02月14日
    瀏覽(22)
  • Godot VisualStudio外部編輯器設(shè)置

    Godot VisualStudio外部編輯器設(shè)置

    Godot專欄地址 Godot本質(zhì)上只是一個(gè)游戲引擎,對C#只做了最小的適配,就是能打開,但是不能Debug。Godot支持許多外部編輯器,比如vs code和 visual studio 。但是我看網(wǎng)上說 vs code 的godot C# debug支持極差,別人踩過坑了那我就不去繼續(xù)踩坑了。 【Godot】基礎(chǔ)C#腳本入門以及vs調(diào)試設(shè)置

    2024年02月07日
    瀏覽(11)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包