GithubHelp home page GithubHelp logo

Comments (9)

lljj-x avatar lljj-x commented on May 13, 2024

你是指 type: array ,配置了 ui:widget ? widget 都是v-model的形式,$emit('input', value);

from vue-json-schema-form.

hallwong avatar hallwong commented on May 13, 2024

from vue-json-schema-form.

lljj-x avatar lljj-x commented on May 13, 2024

你可以提供下codepon或类似代码演示。

如果ui:widget,需要v-model双向绑定值,实际就是 value props,和 emit('input', newValue) 更新数据

from vue-json-schema-form.

hallwong avatar hallwong commented on May 13, 2024

这是json
"schema": { "type": "object", "required": [], "properties": { //模板选择 "dataSource": { "type": "array", "title": "显示内容(至少选中两个)", "items": { "type": "string", "enum": [ "1", "2", "3", "4" ], "enumNames": [ "为你推荐", "新品上架", "热销商品", "聚划算" ] }, "default":[], "uniqueItems": true }, "fontWeight": { "title": "文本样式", "type": "string", "ui:widget": "RadioWidget", "default": "normal", "enum": [ "normal", "bold" ], "enumNames": [ "常规", "加粗" ] } }, "ui:order": [ "dataSource", "fontWeight" ] }, "uiSchema": { "dataSource": { // 'ui:widget': 'RadioWidget' 'ui:widget': () => import('@/components/themeEditor/componentsProperties/pageActive-CheckDataType') } }, "formFooter": { "show": false }, "formProps": { // "labelPosition": "left", "labelWidth": "100px", "labelSuffix": ":" }

这是自定义组件的代码
`

{{ item.label }}
<script> export default { name: "pageActive-CheckDataType", props: ['value'], // watch: { // value(val) { // // } // }, data() { return { form: { checkedArray: [] }, tempType: '', dataOptions: [ { image: '', label: '为你推荐', value: '1' }, { image: '', label: '新品上架', value: '2' }, { image: '', label: '热销商品', value: '3' }, ] } }, mounted() { this.form.checkedArray = this.value.split(','); }, methods: { handleCheckedChange(item) { this.$emit('input', this.form.checkedArray.toString()) } } } </script> <style scoped lang="scss"> .style-options-select { .check-item { display: block; background-color: #ffffff; padding: 0 5px; margin-bottom: 3px; label { display: block; } } } </style>

`

from vue-json-schema-form.

hallwong avatar hallwong commented on May 13, 2024

实际测试只有type为string的自定义widget 可以用$emit( input )更新

from vue-json-schema-form.

lljj-x avatar lljj-x commented on May 13, 2024

你这里 emit 出去的字符串,是为了测试你说的字符串对吗 ? 你提供一个 在线 https://codepen.io/ 代码演示吧

--

内部组件数组的同步值也是类似,比如 多选框,多文件上传都是这样方式,也可以参考下。

from vue-json-schema-form.

hallwong avatar hallwong commented on May 13, 2024

好的。如果实在不能更新数组枚举,我就只能改变方式,用字符串模式。谢谢你的回复。

from vue-json-schema-form.

lljj-x avatar lljj-x commented on May 13, 2024

不客气,最终还是不行可以带上 在线代码演示。

from vue-json-schema-form.

hallwong avatar hallwong commented on May 13, 2024

晚些我会我会截图说明。

from vue-json-schema-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.