Вот моя установка использовать материализовать с Vue Webpack template:
сборки/webpack.base.conf.js
var webpack = require('webpack')
module.exports =
resolve: {
alias: {
...
'jquery': 'materialize-css/node_modules/jquery/dist/jquery.js'
}
},
module: {
rules: [
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
...
options: {
limit: 10000
....
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jquery',
jQuery: 'jquery',
'window.$': 'jquery',
'window.jQuery': 'jquery'
})
]
}
index.html
<head>
...
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
package.json
{
...
"dependencies": {
"materialize-css": "^0.98.2",
...
"devDependencies": {
"@types/jquery": "^2.0.43", // ==> if using typescript
SRC/main.js
import 'materialize-css'
import 'materialize-css/dist/css/materialize.css'
Таким образом, для "ввода поле выбора", как показано ниже:
<div class="input-field" ref="myInput">
<select>
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
</select>
<label>Materialize Select</label>
</div>
... вы могли бы поставить этот код в mounted
жизненный цикл крючке:
mounted() {
$(this.$refs.myInput).material_select()
Посмотрите на этот вопрос на [material input] (http://stackoverflow.com/q/40888352/1610034) и [эта скрипка] (https://jsfiddle.net/sanjeevks121/t3ntexff/). – Saurabh