search

Home  >  Q&A  >  body text

javascript - How to use weui's picker in vue?

I want to use weui's picker in vue.js, and also introduce weui.js. Why is the error weui is not defined reported?

<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>
仅有的幸福仅有的幸福2776 days ago979

reply all(3)I'll reply

  • 阿神

    阿神2017-05-19 10:35:28

     import weui from 'weui.js' 使用node包引入方式

    reply
    0
  • 怪我咯

    怪我咯2017-05-19 10:35:28

    Tryimport weuiJs改成import weui

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-19 10:35:28

    You imported weuijs, and you are using weui.

    Solution

    1. Change weuijs to weui

    2. Change weui to weuijs

    reply
    0
  • Cancelreply