TypeError: this.getOptions is not a function
See original GitHub issuevue create -p dcloudio/uni-preset-vue uni-app
npm i @dcloudio/uni-ui --save
npm i sass -D
npm i sass-loader -D
// index.vue
<template>
<view class="content">
<uni-list>
<uni-list-item v-for="(account, index) in accounts" :key="index" :note="account.nickname"/>
</uni-list>
</view>
</template>
<script>
import { uniList } from '@dcloudio/uni-ui'
export default {
components: { uniList },
data() {
return {
accounts: []
}
},
onLoad() {
this.getAccounts()
},
methods: {
getAccounts(){
this.accounts = [{ nickname: 1, nickname: 2, nickname: 3, }]
}
}
}
</script>
<style>
....
</style>
错误信息:
ERROR Failed to compile with 1 error 下午3:50:09
error in ./node_modules/@dcloudio/uni-ui/lib/uni-list/uni-list.vue?vue&type=style&index=0&lang=scss&
TypeError: this.getOptions is not a function
at runMicrotasks (<anonymous>)
@ ./node_modules/@dcloudio/uni-ui/lib/uni-list/uni-list.vue?vue&type=style&index=0&lang=scss& 1:0-747 1:763-766 1:768-1512 1:768-1512
@ ./node_modules/@dcloudio/uni-ui/lib/uni-list/uni-list.vue
@ ./node_modules/babel-loader/lib!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-preprocess-loader??ref--12-1!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/script.js!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/vue-loader/lib??vue-loader-options!./node_modules/@dcloudio/webpack-uni-mp-loader/lib/style.js!./src/pages/index/index.vue?vue&type=script&lang=js&
@ ./src/pages/index/index.vue?vue&type=script&lang=js&
@ ./src/pages/index/index.vue
@ ./src/main.js?{"page":"pages%2Findex%2Findex"}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
TypeError: this.getOptions is not a function - vue.js
A quick fix is to remove that additional package from XXXX/node_modules . You can also check what package version the XXXX module use...
Read more >TypeError: this.getOptions is not a function #517 - GitHub
It looks like #501 dropped loader-utils as a dependency where this function came from, and instead tries to call this.getOptions which doesnt ...
Read more >TypeError: this.getOptions is not a function 的解决(vue,react)
1.npm uninstall less-loader · 2.npm install less-loader@5.0.0 ...
Read more >Syntax Error: TypeError: this.getOptions is not a function
Changing less-loader version to 7.3.0 fixed this issue.
Read more >this.getoptions is not a function vue - Code Grepper
vuejs sass Syntax Error: TypeError: this.getOptions is not a function ; 1. # It seems like sass-loader@11.0.0 doesn't work with vue@2.6.12. ; 2....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
我发现是sass-loader的问题,安装了最新版本的sass-loader v11.0.1 就会有这个问题,改成 “sass-loader”: “^10.1.1” 就正常了。
还没修复