Check out this snippet featuring the select component using createElement
:
Vue.component('myselect', {
props: ['option'],
render: function(createElement) {
var self = this
return createElement(
'select', {
domProps: {
value: self.option.value
},
on: {
input: function(event) {
self.option.value = event.target.value
}
}
}, [
createElement('option', {
attrs: {
value: 0
}
}, 'Less than 1'),
createElement('option', {
attrs: {
value: 1
}
}, '1'),
]
)
},
})
To see it in action, view the live example here: https://jsfiddle.net/aaoehLqe/1/
To gain a better understanding of how it functions, refer to the API documentation for createElement in Vue.js official docs:
// @returns {VNode}
createElement(
// {String | Object | Function}
// An HTML tag name, component options, or function
// returning one of these. Required.
'div',
// {Object}
// A data object corresponding to the attributes
// you would use in a template. Optional.
{
// (see details in the next section below)
},
// {String | Array}
// Children VNodes. Optional.
[
createElement('h1', 'hello world'),
createElement(MyComponent, {
props: {
someProp: 'foo'
}
}),
'bar'
]
)