我一直在尝试在 Javascript 中创建这样的东西:
如您所见,容器可以被拖动、旋转和调整大小。大多数事情都可以正常工作,但是容器在旋转时调整大小会产生奇怪的输出。
我希望这会发生:
相反,我得到了这个:
这是完整的代码:
https://jsfiddle.net/c0krownz/
或者,
var box = document.getElementById("box");
var boxWrapper = document.getElementById("box-wrapper");
var initX, initY, mousePressX, mousePressY, initW, initH, initRotate;
function repositionElement(x, y) {
boxWrapper.style.left = x;
boxWrapper.style.top = y;
}
function resize(w, h) {
box.style.width = w + 'px';
box.style.height = h + 'px';
boxWrapper.style.width = w;
boxWrapper.style.height = h;
}
function getCurrentRotation(el) {
var st = window.getComputedStyle(el, null);
var tm = st.getPropertyValue("-webkit-transform") ||
st.getPropertyValue("-moz-transform") ||
st.getPropertyValue("-ms-transform") ||
st.getPropertyValue("-o-transform") ||
st.getPropertyValue("transform")
"none";
if (tm …
Run Code Online (Sandbox Code Playgroud)所以我有Component1
,
<!-- Component1 -->
<script lang="ts" setup>
defineProps<{ msg: string }>()
</script>
<template>
<p>{{ msg }}</p>
</template>
Run Code Online (Sandbox Code Playgroud)
然后我在全球范围内注册它,
// main.ts
import { createApp } from "vue"
import App from "./App.vue"
import Component1 from "./Component1.vue"
const app = createApp(App)
app.component("Component1", Component1)
app.mount("#app")
Run Code Online (Sandbox Code Playgroud)
之后我用它作为,
<script setup lang="ts"></script>
<template>
<Component1 />
</template>
Run Code Online (Sandbox Code Playgroud)
但是我没有得到 的 props 的类型推断Component1
。那么如何为这个全局组件添加打字稿支持呢?
我有一个父组件:
<template>
<ChildComponent :styles="styles" />
</template>
<script>
export default {
data: () => ({
styles: `
p {
color: red
}
`
})
}
</script>
Run Code Online (Sandbox Code Playgroud)
这是子组件:
<template>
<p>Hello World</p>
</template>
<script>
export default {
props: {
styles: {
type: String,
required: true
}
}
}
</script>
<style scoped>
</style>
Run Code Online (Sandbox Code Playgroud)
现在我想使用子组件中父组件提供的那些样式作为作用域样式。例如:
<!-- ChildComponent.vue -->
<style scoped>
p {
color: red
}
</style>
Run Code Online (Sandbox Code Playgroud)
有什么办法吗?
因此,目前在 XCode 13 中,当我第一次创建项目时,xcode 会生成 iOS 14.0+ 的项目结构。
我是 iOS 新手,我想创建一个针对 iOS 13.0+ 的项目。如何告诉 XCode 生成 iOS 13.0+ 的项目模板?
这是我的stylelint.config.js
,
module.exports = {\n extends: ['stylelint-config-standard-scss'],\n rules: {\n 'at-rule-no-unknown': [\n true,\n {\n ignoreAtRules: ['tailwind']\n }\n ],\n 'declaration-block-trailing-semicolon': null,\n 'scss/at-extend-no-missing-placeholder': null,\n 'color-function-notation': 'legacy',\n 'selector-pseudo-class-no-unknown': [\n true,\n {\n ignorePseudoClasses: ['deep']\n }\n ]\n }\n}\n
Run Code Online (Sandbox Code Playgroud)\n当我运行时stylelint "**/*.{scss,css,sass,svelte}"
,出现以下错误:
yarn run v1.22.17\n$ stylelint "**/*.{scss,css,sass,svelte}"\n\nsrc/css/app.scss\n 1:1 \xe2\x9c\x96 Unexpected unknown at-rule "@tailwind" scss/at-rule-no-unknown\n 2:1 \xe2\x9c\x96 Unexpected unknown at-rule "@tailwind" scss/at-rule-no-unknown\n 3:1 \xe2\x9c\x96 Unexpected unknown at-rule "@tailwind" scss/at-rule-no-unknown\n\nerror Command failed with exit code 2.\ninfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.\n
Run Code Online (Sandbox Code Playgroud)\n … 所以我有这个文本字段,
var value = remember { mutableStateOf("") }
OutlinedTextField(
value = value.value,
placeholder = {
Text("Search Users")
},
singleLine = true,
modifier = Modifier.height(40.dp),
onValueChange = {
value.value = it
},
)
Run Code Online (Sandbox Code Playgroud)
我将高度设置为40.dp
您所看到的。然而看起来是这样的,
看起来文本/占位符被切断。如何解决这个问题?
假设我有一个名为 的可重用组件button.svelte
,
<script>
export let text = undefined
</script>
<button>{text}</button>
Run Code Online (Sandbox Code Playgroud)
现在我在另一个组件中重用这个组件,如下所示,
<script>
import { onMount } from "svelte"
import Button from "./Button.svelte"
let button
onMount(() => {
console.log(button) // How do I print the html of the button element?
})
</script>
<Button text="Button" bind:this="{button}"></Button>
Run Code Online (Sandbox Code Playgroud)
但button
ofbind:this
似乎没有按钮元素的 html。如何获取按钮的 html 元素?
我的文件夹结构是这样的:
|-profile
|-- index.vue
|-- address/index.vue
Run Code Online (Sandbox Code Playgroud)
然后我做<nuxt-child />
这不呈现的内容profile/index.vue
!它只是加载了一条全新的路线。请帮忙!
所以我有这个可组合项尝试从存储中读取数据,
@Composable
private fun Screen() {
val launcher = rememberLauncherForActivityResult(contract = ActivityResultContracts.StartActivityForResult()) { result ->
val uri = result.data?.data.toString()
if(uri !== null) {
val file = File(uri)
val bytes = file.readBytes()
println(bytes)
}
}
Column() {
Button(onClick = {
val intent = Intent().setType("*/*").setAction(Intent.ACTION_OPEN_DOCUMENT)
launcher.launch(intent)
}) {
Text("Open file")
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是,它给了我这个错误:content:/com.android.providers.downloads.documents/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2FIMG_CEFEFF486A8C-1.jpeg: open failed: ENOENT (No such file or directory)
。我在这里做错了什么?请帮忙。
javascript ×4
css ×3
vue.js ×3
android ×2
html ×2
kotlin ×2
coordinates ×1
dart ×1
flutter ×1
math ×1
nuxt.js ×1
sass ×1
svelte ×1
svelte-3 ×1
swiftui ×1
tailwind-css ×1
typescript ×1
vuejs3 ×1
xcode ×1