由于前面对html进行过解析,今天想用vue拖拽,实现一手类似快站那种自动生成代码,结果就遇到了拖拽组件过去怎么无法解析的问题,因为vue的v-html为了防止xss攻击只能解析html
思路
先实现简单页面 分三块左中右,左边是需要拖动的组件,中间是用于组件排列显示,右边是解析出的代码
左边组件列表代码
备选项
import OneComponent from '../components/oneComponent'
export default {
name: '',
data() {
return {
radio: '2',
title: ['Radio 单选框']
}
},
components:{
OneComponent
},
}
中间组件显示代码
class="box"
:width="ruleForm.inputW"
:height="ruleForm.inputH"
>