Vue.component("search-box", { props: ["placeholder", "width"], data: function () { let width = this.width if (width == null) { width = "10em" } return { realWidth: width, realValue: "" } }, methods: { onInput: function () { this.$emit("input", { value: this.realValue}) this.$emit("change", { value: this.realValue}) }, clearValue: function () { this.realValue = "" this.focus() this.onInput() }, focus: function () { this.$refs.valueRef.focus() } }, template: `
` })