vue.js裡想用weui的picker,也引入了weui.js,為什麼報錯weui is not defined?
<template>
<p class="wrap">
<a href="javascript:;" class="weui-btn weui-btn_default" id="showPicker"》单列选择器</a>
</p>
</template>
<script>
import weuiJs from '../weui-js/weui.js'
export default {
methods: {
checkPicker: function () {
weui.picker([{
label: '飞机票',
value: 0
}, {
label: '火车票',
value: 1
}, {
label: '的士票',
value: 2
},{
label: '公交票 (disabled)',
disabled: true,
value: 3
}, {
label: '其他',
value: 4
}], {
onChange: function (result) {
console.log(result);
},
onConfirm: function (result) {
console.log(result);
}
});
}
}
}
</script>
雷雷
把
import weuiJs
改成import weui
試試你import了weuijs,使用的確是weui。
解決方法
把weuijs改成weui
把weui改成weuijs