Custom Field with random default value

Using the documentation here - Fields | Kirby CMS - to create a custom field type (let’s call it ‘code’) that simply extends the text field and has a ‘default’ method in the plugin index.php that returns a randomly generated code as the default value.

It works OK, but when using in a structure it seems that the value it returns gets cached and always appears as the same thing unless the page is refreshed. I am sure this me being rubbish with vue, and I need to look at doing something in the index.js instead… but just wanted a little bit of guidance please.