hfhbd / routing-compose

Routing feature for Compose Web, Compose HTML and Desktop
https://routing.softwork.app/
Apache License 2.0
135 stars 14 forks source link

没看明白怎么用 #385

Closed YuXunSTC closed 2 months ago

YuXunSTC commented 2 months ago

我按照教程 添加了指定的依赖,找不到对应的方法名称,能不能出一个使用远程依赖的demo ,不要使用依赖本地项目
在项目中建个文件夹,叫sample ,然后里面是个完整的项目,就像compose-multiplatform 中的那种samples ,我想如果这样,我应该就能看明白怎么用了。

由于我看不懂如何用,我把这个项目拉下来,然后在这个基础上改一改╮(╯▽╰)╭,只能先这样搞了

hfhbd commented 2 months ago

Please use English.

What problem do you have exactly? The latest gav is app.softwork:routing-compose:0.2.14 and it's available on maven central.

YuXunSTC commented 2 months ago

I don't know how to use this library I downloaded a compose multiplatform template that only contains web, 35941718539527_ pic

and I don't know where to put this dependency, 35951718540492_ pic if I put this dependency in the commonMain ,it will build error

Could not determine the dependencies of task ':kotlinNpmInstall'.
> Could not resolve all dependencies for configuration ':composeApp:wasmJsNpmAggregated'.
   > Could not resolve app.softwork:routing-compose:0.2.14.
     Required by:
         project :composeApp
      > No matching variant of app.softwork:routing-compose:0.2.14 was found. The consumer was configured to find a library for use during 'kotlin-runtime', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.js.public.package.json' with value 'public-package-json', attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm', attribute 'org.jetbrains.kotlin.wasm.target' with value 'js' but:
          - Variant 'jsApiElements-published' declares a library:
              - Incompatible because this component declares a component for use during 'kotlin-api', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'js' and the consumer needed a component for use during 'kotlin-runtime', as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'wasm'
              - Other compatible attributes:
                  - Doesn't say anything about its target Java environment (preferred optimized for non-jvm)
                  - Doesn't say anything about org.jetbrains.kotlin.js.public.package.json (required 'public-package-json')
                  - Doesn't say anything about org.jetbrains.kotlin.wasm.target (required 'js')

if I put this dependency in the jsMain ,I can't find HashRouter() method ,Looks like the library wasn't pulled down Snip20240616_2

I have learned compose multiplatform for a short time. If there have a complete sample that uses remote dependency, I should be able to understand how to use this library, just like the samples folder in compose multiplatform official library. I have two more demands

  1. I want to know where the ''implementation("app.softwork:routing-compose:0.2.14")'' dependency should be placed
  2. Can you make a complete sample using remote dependency in the project, so that small white people like me can use this library smoothly
hfhbd commented 2 months ago

There is no wasm target yet, so you can't use this navigation library, but there is a library from JetBrains/Google with experimental support: https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-navigation-routing.html

YuXunSTC commented 2 months ago

🤦‍♂️ thank you