Kallan DAUTRICHE's answer is on the right track, but not quite what I needed (or what the OP needed I think).
You have to set the ref of the element so you can directly select the input element of your DOM to get/set selection details
Template:
<v-text-field v-model="model" ref="textField">
Script:
export default Vue.extend({
data: () => ({
model: "",
}),
methods: {
insertText(text) {
// Get the input element by tag name, using the ref as a base for the search
// This is more vue-friendly and plays nicer when you duplicate components
const el = this.$refs.textField.querySelector("input");
// Insert text into current position
let cursorPos = el.selectionEnd; // Get current Position
this.model =
this.model.substring(0, cursorPos) +
text +
this.model.substring(cursorPos);
// Get new cursor position
cursorPos += text.length;
// Wait until vue finishes rendering the new text and set the cursor position.
this.$nextTick(() => el.setSelectionRange(cursorPos, cursorPos));
}
},
});