Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

似乎并没有提供对labelcategory和Connectioncategory的增删改查操作? #143

Open
VelikayaScarlet opened this issue Nov 9, 2023 · 2 comments

Comments

@VelikayaScarlet
Copy link

vue.esm.js:591 [Vue warn]: Error in event handler for "click": "TypeError: Cannot read properties of undefined (reading 'trim')"

found in

--->


at src\components\Demo.vue

at src\App.vue

warn @ vue.esm.js:591
logError @ vue.esm.js:1737
globalHandleError @ vue.esm.js:1732
handleError @ vue.esm.js:1721
Vue.$emit @ vue.esm.js:2540
click @ vuetify.js:1363
invoker @ vue.esm.js:2027
fn._withTask.fn._withTask @ vue.esm.js:1826
vue.esm.js:1741 TypeError: Cannot read properties of undefined (reading 'trim')
at t.construct (index.js:16:1)
at t.set [as json] (index.js:16:1)
at VueComponent.addLabel (Demo.vue:329:1)
at VueComponent.invoker (vue.esm.js:2027:1)
at Vue.$emit (vue.esm.js:2538:1)
at VueComponent.click (vuetify.js:1363:1)
at invoker (vue.esm.js:2027:1)
at fn._withTask.fn._withTask (vue.esm.js:1826:1)
logError @ vue.esm.js:1741
globalHandleError @ vue.esm.js:1732
handleError @ vue.esm.js:1721
Vue.$emit @ vue.esm.js:2540
click @ vuetify.js:1363
invoker @ vue.esm.js:2027
fn._withTask.fn._withTask @ vue.esm.js:1826

@VelikayaScarlet VelikayaScarlet changed the title 这个包使用的json数据似乎和JSON.jsonify给的json的格式不一样导致读写错误 这个包使用的json数据似乎和JSON.stringify() 给的json的格式不一样导致this.annotator.store.json = JSON.stringify(xxxxx) 的时候出错 Nov 9, 2023
@VelikayaScarlet VelikayaScarlet changed the title 这个包使用的json数据似乎和JSON.stringify() 给的json的格式不一样导致this.annotator.store.json = JSON.stringify(xxxxx) 的时候出错 似乎并没有提供对labelcategory和Connectioncategory的增删改查操作? Nov 9, 2023
@VelikayaScarlet
Copy link
Author

已解决
addLabel: function() {
let jsonData = JSON.stringify(this.annotator.store.json, null, 2);
let list = JSON.parse(jsonData);
const newLabelCategory = {
id: list.labelCategories.length,
text: this.addLabelText,
color: this.getRandomColor(),
borderColor: this.getRandomColor()
};
this.annotator.store.labelCategoryRepo.add(newLabelCategory)
this.getCode()
},

@VelikayaScarlet
Copy link
Author

        addLabel: function() {
          let newID = -1;
          for (let [_, category] of this.annotator.store.labelCategoryRepo) {
              newID = category["id"]+1
          }
          const newLabelCategory = {
            id: newID, 
            text: this.addLabelText,
            color: this.getRandomColor(),
            borderColor: this.getRandomColor()
          };
          this.annotator.store.labelCategoryRepo.add(newLabelCategory)
          console.log(this.labelCategories);
          this.getCode()
        },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant