2
export default {
  setup() {
    const imageUrl = ref("");
    const title = ref("");
    const description = ref("");
    var source = "Global";

    const form = reactive({
      title: "",
      description: "",
      // src: source,
    });
    //...
  }
}

How do I add src: "source" (a new property) to form (the reactive object)? Like how we append on ref.

1 Answer 1

3

You can assign the field directly via form.src = source. For example, you could have a function that does this:

const addSourceToForm = () => form.src = source

And you can call that function later, e.g., from a button click:

<button @click="addSourceToForm">Add source</button>

demo

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.