uni-app icon indicating copy to clipboard operation
uni-app copied to clipboard

defineModel 无法使用,提示 "useModel" is not exported

Open LengGeng opened this issue 1 year ago • 5 comments

"useModel" is not exported by "node_modules/.pnpm/@[email protected]/node_modules/@dcloudio/uni-mp-vue/dist/vue.runtime.esm.js", imported by "src/components/categories/CategoryScrollSelector.vue?vue&type=script&setup=true&lang.ts". at components/categories/CategoryScrollSelector.vue:1:9 1: import { useModel as _useModel, defineComponent as _defineComponent } from 'vue' ^ 2: import { unref as _unref, toDisplayString as _toDisplayString, t as _t, o as _o, f as _f, n as _n } from "vue"

LengGeng avatar Apr 09 '24 14:04 LengGeng

+1

feibi avatar Apr 12 '24 07:04 feibi

+1

w4ng3 avatar Apr 29 '24 08:04 w4ng3

+1

crrzzzz avatar May 04 '24 17:05 crrzzzz

+1

li1164267803 avatar May 05 '24 09:05 li1164267803

@fxy060608 h5可以使用了, 但是微信小程序还是不行

extclp avatar May 08 '24 08:05 extclp

有朋友测过了? 现在怎么样了?

skiyee avatar Jun 15 '24 03:06 skiyee

我测试微信小程序,运行 ok,可以参考下面 demo 运行

https://gitcode.net/xiurensha5731/uni-app-questions/-/blob/main/src/pages/index/index.vue

index page

<template>
  <div>
   <div>你输入了:{{ str }}</div>
    <myInput v-model:count="str"></myInput>
  </div>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import myInput from "../../components/my-input.vue";
const str = ref("2");
</script>

对应组件 my-input

<template>
  <div>
    <input
      type="text"
      v-model="count"
      style="height: 20px; border: 1px solid black"
    />
  </div>
</template>
<script lang="ts" setup>
const count = defineModel<string>("count", { default: "" });
</script>

<style></style>

Otto-J avatar Jun 17 '24 09:06 Otto-J