在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:xaboy/json2vue开源软件地址:https://github.com/xaboy/json2vue开源编程语言:TypeScript 85.3%开源软件介绍:json2vue以json方式生成vue,可用于后端控制前端Vue组件生成 本项目从 form-create 中抽出,成为独立的功能
安装Npm npm install json2vue CDN <script src="https://cdn.jsdelivr.net/npm/json2vue/dist/json2vue.min.js"></script> 示例1function mock(){
return {
rule:[
{
type:'ElButton',
ref:'btn',
props:{
disabled:true
},
children:['test']
}
],
mounted(){
console.log(this)
}
};
}
var jv = new jsonVue(mock())
var vm = jv.mount('#app'); 等同于 <ElButton :disabled="true" ref="btn">test</ElButton> var vm = new Vue({
el:'#app',
mounted(){
console.log(this)
}
}) 示例2function mock(){
return {
data:function(){
return {
disabled:false
}
},
rule:function(){
return [
{
type:'ElButton',
ref:'btn',
props:{
disabled:this.disabled
},
on:{
click:()=>{
this.disabled = true;
}
},
children:['test']
}
]
},
mounted(){
console.log(this)
}
};
}
var jv = new jsonVue(mock())
var vm = jv.mount('#app'); 等同于 <ElButton :disabled="disabled" @click="disabled = true" ref="btn">test</ElButton> var vm = new Vue({
el:'#app',
data:function(){
return {
disabled: false
}
},
mounted(){
console.log(this)
}
}) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论