how to call method on petite-vue/VueJS component

Viewed 154

I have a very small vue-petite component, with following template.

When button is clicked outside, I want to call method clear() on component letting it clear itself.

    <template id="input-template">
        <input type="text" v-model="keyword">
    </template>

    <div v-scope>
     <div v-scope="model"></div>
     <button @click="model.clear()">
    </div>
    createApp({model:
    {
      $template: '#input-template',
      keyword: '',
      clear() {
        this.keyword = '';
      }
    }}).mount();
0 Answers
Related