簡體   English   中英

jQuery 需要一個 window 和 vue native 中的文檔

[英]jQuery requires a window with a document in vue native

i ran the npm install jquery --save command to install jquery in my vue native project but i still getting this error jQuery requires a window with a document

在我的模板中:

   <view >  
        <touchable-opacity class="button" :on-press="test">
          <text class="loginText">login</text>
        </touchable-opacity>
      </view>

在我的腳本中:

import $ from 'jquery'

Vue.use(Vuex);


export default {
  data:()=>({
     loginObj: {
      memberCode: '',
      password: '',
    }
  }),
  methods: {
    test(){
        $(".button").css("display", "none");
    },

是的,Vue Native 是 React Native API 的包裝器。 JQuery heavily relies on HTML DOM where vue-native and react-native have their own DOM-like native view.they are differently.And you can use JQuery in a vue web project,not a vue-native app project.

參考vue-native鏈接

謝謝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM